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 anyone make this in LaTeX?

picture showing the wanted result

I mean the section numbering on the left side? Perhaps, this can be done with the titlesec package. Or maybe there is another way.

share|improve this question
1  
Have a look at the documentation of the tocloft package. –  Jubobs Mar 4 '13 at 12:12
    
Welcome to TeX.sx! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are "too localized". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. –  egreg Mar 4 '13 at 13:20
add comment

1 Answer

Here's some code that you can use as a starting point; the idea is to use the titlesec package to customize the sectional unit titles; of course, make the necessary adjustments according to your needs:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[explicit]{titlesec}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{lipsum}% just to generate text for the example

\definecolor{myblue}{RGB}{76,117,180}
\newlength\mylen
\setlength\mylen{4em}

\titleformat{\section}
{\normalfont\Large\sffamily}{\llap{\makebox[3\mylen]{\textcolor{myblue}{\fontsize{40}{48}\selectfont\thesection.}}}}{0em}{\makebox[\linewidth][r]{\setlength\fboxsep{10pt}\colorbox{myblue}{\parbox[b]{\dimexpr\textwidth+\mylen-2\fboxsep-2\fboxrule\relax}{\vskip1ex\textcolor{white}{\scshape#1}\vskip1ex}}}}
\titleformat{\subsection}[runin]
{\normalfont\sffamily}{\llap{\makebox[\mylen][l]{\textcolor{myblue}{\thesubsection}}\hfill}}{0em}{#1}
\titleformat{\subsubsection}[runin]
{\normalfont\sffamily}{\llap{\makebox[\mylen][l]{\textcolor{myblue}{\thesubsubsection}}\hfill}}{0em}{#1}

\titlespacing*{\subsection}
{0pt}{3.25ex plus 1ex minus .2ex}{0pt}
\titlespacing*{\subsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{0pt}

\begin{document}

\section{A Test Numbered Section with a Title Spanning Several Lines}
\subsection{}
\lipsum[4]
\subsection{}
\lipsum[4]
\subsubsection{}
\lipsum[4]
\subsubsection{}
\lipsum[4]
\subsection{}
\lipsum[4]

\end{document}

enter image description here

Now that I revisit this question, another option (perhaps a better one) would be to use titlesec (as in my previous code) to customize the \section titles and then the enumitem package to produce an enumerated list giving the desired alignment for the labels; here's an example using this approach (I defined a new enumerated list with only two nesting levels, but you can extend my definition up to 10 levels):

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[explicit]{titlesec}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{lipsum}% just to generate text for the example

\definecolor{myblue}{RGB}{76,117,180}
\newlength\mylen
\setlength\mylen{4em}

\titleformat{\section}
{\normalfont\Large\sffamily}{\llap{\makebox[3\mylen]{\textcolor{myblue}{\fontsize{40}{48}\selectfont\thesection.}}}}{0em}{\makebox[\linewidth][r]{\setlength\fboxsep{10pt}\colorbox{myblue}{\parbox[b]{\dimexpr\textwidth+\mylen-2\fboxsep-2\fboxrule\relax}{\vskip1ex\textcolor{white}{\scshape#1}\vskip1ex}}}}

\newlist{blueenum}{enumerate}{2}
\setlist[blueenum,1]{%
  label=\textcolor{myblue}{\thesection.\arabic*},
  leftmargin=-10pt,labelsep=18pt,
  font=\bfseries}
\setlist[blueenum,2]{
  label=\textcolor{myblue}{\theblueenumi.\arabic*},
  leftmargin=25pt,labelsep=35pt}

\begin{document}

\section{A Test Numbered Section with a Title Spanning Several Lines}
\begin{blueenum}
\item \lipsum[4]
\item \lipsum[4]
  \begin{blueenum}
  \item \lipsum[4]
  \item \lipsum[4]
  \end{blueenum}
\item \lipsum[4]
\end{blueenum}

\end{document}

enter image description here

This last approach also allows you to easily produce the desired variable indentation.

share|improve this answer
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.