Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Can you help me please with formatting?

I like this format: example formating

How can I define this title with grey underline (width of all page)? Font is sans serif (Arial). And how can I make grey box around some paragraph?

share|improve this question
1  
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Kurt Oct 23 '12 at 16:32
    
Do the titles refer to things like a \section? Or should it just be a title that is bold with a horizontal rule below it. What about the paragraph box: should it be breakable across the page boundary or not? –  Werner Oct 23 '12 at 17:01
    
@Kurt: Thanks for info :). –  Petra Oct 23 '12 at 17:06
    
@Werner: Yes, title refer to \section*. Box please in width of page. –  Petra Oct 23 '12 at 17:08
add comment

1 Answer

up vote 7 down vote accepted

You can use the titlesec package to customize the formatting for the sectional unit headings; the mdframed or the framed packages give you the possibility to get framed text; a little example:

\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{mdframed}
\usepackage{lipsum}% just to generate text for the example

\colorlet{mycolor}{gray!50}

\titleformat{\section}
  {\normalfont\sffamily\Large\fontfamily{phv}\selectfont}
  {\thesection.}{.5em}{}[\vspace{.2ex}\color{mycolor}\titlerule]

\newmdenv[linecolor=mycolor,skipabove=\topsep,skipbelow=\topsep,
leftmargin=-5pt,rightmargin=-5pt,
innerleftmargin=5pt,innerrightmargin=5pt]{mybox}

\begin{document}

\section*{Title}

\lipsum[2]
\begin{mybox}
\lipsum[2]
\end{mybox}

\end{document}

enter image description here

I wasn't sure about the desired width for the frame, so here's another option:

\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{mdframed}
\usepackage{lipsum}% just to generate text for the example

\colorlet{mycolor}{gray!50}

\titleformat{\section}
  {\normalfont\sffamily\Large\fontfamily{phv}\selectfont}
  {\thesection.}{.5em}{}[\vspace{.2ex}\color{mycolor}\titlerule]

\newmdenv[linecolor=mycolor,skipabove=\topsep,skipbelow=\topsep]{mybox}

\begin{document}

\section*{Title}

\lipsum[2]
\begin{mybox}
\lipsum[2]
\end{mybox}

\end{document}

enter image description here

share|improve this answer
    
Yes, that's it. Thank you :). –  Petra Oct 23 '12 at 17:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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