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.

I was wondering if you could help me with some alignment issues. I've search both here and Google but haven't really found a decent solution.

This is what I have (LaTeX default):

1 First section

  1. Apple
  2. Banana
  3. Cherry

1.1 First subsection

  - Foo
  - Bar

This is what I want:

  1  First section

  1. Apple
  2. Banana
  3. Cherry

1.1  First subsection

  -  Foo
  -  Bar

Notice how everything lines up in the margin in the second example. I think this makes the rhythm of the document flow much better.

A great example of what I want can be found in the documentation for the microtype package.

share|improve this question
    
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. –  Werner Oct 30 '11 at 17:39
    
Note that in traditional LaTeX documents the sectional numbering is not boxed and has a fixed separation between the number and the title (say \quad). You want to forego this and have a left-aligned number within a boxed width of say <width> and then have the same for any lists? What about the period . in your enumerated list? That doesn't align in a similar way to the itemized list or the sectional numbers. –  Werner Oct 30 '11 at 17:43

1 Answer 1

up vote 14 down vote accepted

The solution below uses the enumitem package to customize the enumerate and itemize environments, and the titlesec package to customize the section and subsection headings.

screenshot

Note that I have loaded the geometry package with showframe=true to show where the page boundaries lie.

\documentclass{article}

\usepackage[showframe=true]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{enumitem}

\titleformat{\section}%
            {\Large\bfseries}% format
            {\llap{% label
               \thesection\hskip 9pt}#1}%
            {0pt}% horizontal sep
            {}% before

\titleformat{\subsection}%
        {\bfseries}% format
        {\llap{% label
           \thesubsection\hskip 9pt}#1}%
        {0pt}% horizontal sep
        {}% before

\setlist[enumerate]{leftmargin=0mm}
\setlist[itemize]{leftmargin=0mm}

\begin{document}
\section{First section}
\begin{enumerate}
 \item apple
 \item orange
 \item grape
\end{enumerate}

\subsection{First subsection}
\begin{itemize}
 \item foo
 \item bar
 \item foobar
\end{itemize}
\end{document}
share|improve this answer
1  
Thank you so much, I didn't think it would be this simple! You response is much appreciated! –  user2473 Oct 30 '11 at 18:15

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.