2

Example

The example picture is what I desire to create in Latex. I have managed to create something similar but without the rectangular gray background. I am also a total rookie to latex.

I would look forward If someone could help me with my problem. I assume that actually it should be a very easy solution to this specific problem.

\documentclass[11pt,a4paper, titlepage, headexclude, footexclude, oneside, openany]{scrartcl} 
\begin{document}
\subject{ {\textsc{{\Huge report} \vspace{5ex} }} \horrule{1pt}\\[-0.5cm] }
\title{Very Interesting Topic to Write A Report About }\\[0.15cm]}
\subtitle{\horrule{1pt}\\[2cm]}
\maketitle
\end{document}
  • Welcome to TeX.SX! You said you created something similar? Do you think you could post the code for what you have so far? It would definitely help us in being able to help you. – Adam Liter Oct 5 '14 at 4:34
  • I am very sorry but I know that I need to mark the source code so my comment gets more user friendly. Therefore I just type it in here. – zakalaka Oct 5 '14 at 4:42
  • @Guido just kind of figured out how to do that ^^ sry about that – zakalaka Oct 5 '14 at 4:56
4

The mdframed package has option to specify which line to print, see section 6.6 of the manual (texdoc mdframed)

\documentclass{article}

\usepackage{mdframed}
\usepackage{xcolor}

\begin{document}
\begin{mdframed}[backgroundcolor=black!10,rightline=false,leftline=false]
\centering 
first line\\
second line\\
third line
\end{mdframed}
\end{document}
  • Thank you very much, practically it is what I was looking for but there is just the topline missing. I just can see the bottom line. I tried it with topline=true but it still did not show up. – zakalaka Oct 5 '14 at 5:08
  • The top line should be there, at least it is in my example. It might be problem with the pdf reader you use. Try, for example with linewidth=12pt to see that the topline is there – Guido Oct 5 '14 at 5:20
2

Here is the a possible solution with tcolorbox package and some exaggerated top and bottom rules.

The individual rules around the box can be controlled using the leftrule=, rightrule= etc. options. A vanishing rule can be achieved by setting the rule to 0pt.

\documentclass[11pt,a4paper, titlepage, headexclude, footexclude, oneside, openany]{scrartcl} 


\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}%
\usepackage{tcolorbox}%


\begin{document}

\begin{tcolorbox}[arc=0mm,auto outer arc, colback=lightgray,leftrule=0pt,rightrule=0pt,toprule=5pt,bottomrule=10pt]
\begin{center}
Analyse des Betriebsverhaltens\par

einer

bestehenden großen Solaranlage 
\end{center}%

\end{tcolorbox}%
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.