3

I would like to produce a text with labels in the left margin, like a reference list. Labels may have different lengths. One way to do this is to define a negative \parindent, as follows:

\parindent-12mm
\makebox[12mm][l]{A} text text text   text text text text text   text text text text   text text  text    texttexttexttext  \par 
\makebox[12mm][l]{ABC} text text text   text text text text   text text text text   text text  text    texttexttexttext 

The purpose of the box is to make the text begin at the left edge of the text column. However, in this way the left edge of the text column won’t be straight, because Tex expands or shrinks spaces evenly along the entire line, including the box. Therefore (instead of the box) I would need, after the label, a command that moves to the left edge of the text column in the same way as a tab command. Is there such a command?

3

This is easy with the enumitem package. Just define

\SetLabelAlign{margin}{\llap{#1~~}}

and use it like

\begin{description}[align=margin,labelsep=0pt]
  \item[A] text text text
  \item[ABC] text text text
\end{description}

MWE

\documentclass{article}
\usepackage{enumitem}
\SetLabelAlign{margin}{\llap{#1~~}}
\usepackage{showframe} % just to show the margins
\begin{document}

\begin{description}[align=margin,labelsep=0pt]
  \item[A] text text text
  \item[ABC] text text text
\end{description}

\end{document} 

Output

enter image description here

Another solution is to define

\SetLabelAlign{margin}{\llap{\makebox[12mm][l]{#1}}}

In this way the result will be

enter image description here

2

Something like this: (???)

The showframe package is just for to show the position of the margins. It can be removed.

\documentclass{article}
\usepackage{showframe}

\begin{document}
\setlength{leftmargini}{0pt}
\begin{itemize}

  \item[A] text text text
  \item[ABC] text text text
\end{itemize}
\end{document}

enter image description here

  • This is useful; thanks! But I don't understand how the command \SetLabelAlign works. Moreover, with the description environment the text paragraph gets a negative indentation; I don't understand why. But with enumerate the left edge of the text is straight, as I want. – Jan Boman Jan 19 '15 at 15:47
1

enumitem already provides a right alignment for labels. Use it with leftmargin=\labelsep

\documentclass{article}
\usepackage{enumitem}
\usepackage{showframe} % just to show the margins
\begin{document}

\begin{description}[align=right,leftmargin=\labelsep]
  \item[A] text text text
  \item[ABC] text text text
\end{description}

\end{document}

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.