0

How can I adjust line spacing of numbers to be in front of text lines within description list: I couldn't managed to solve the problem with lineno package.

\documentclass[10pt]{article}
\usepackage{setspace}
\usepackage{fancyhdr,lipsum}
\makeatletter

 \newsavebox{\@linebox}
 \savebox{\@linebox}[3em][t]{\parbox[t]{3em}{%
   \@tempcnta\@ne\relax
   \loop{\underline{\scriptsize\the\@tempcnta}}\\
     \advance\@tempcnta by \@ne\ifnum\@tempcnta<48\repeat}}

 \pagestyle{fancy}
 \fancyhead{}
 \fancyfoot{}
 \fancyhead[CO]{\scriptsize How to Count Lines}
 \fancyhead[RO,LE]{\footnotesize\thepage}
%% insert this block within a conditional
 \fancyhead[LE]{\footnotesize\thepage\begin{picture}(0,0)%
      \put(-26,-25){\usebox{\@linebox}}%
      \end{picture}}

 \fancyhead[LO]{%
    \begin{picture}(0,0)%
      \put(-18,-25){\usebox{\@linebox}}%
     \end{picture}}
\fancyfoot[C]{\scriptsize Draft copy}
%% end conditional
\makeatother

\begin{document}
\section*{Lorem Ipsum}
{\setstretch{2.8}
\begin{tabular}{ll}
$ALDF$ & Average annual load factor of a DT or HV substation\\
$ALSF$ & Average annual loss factor of a DT or HV substation\\
$APF$ & Average power factor\\
$B$ & Number of all load blocks\\
\end{tabular}
}
\end{document}

numbers are not aligned with text lines.

I modified the code in (https://tex.stackexchange.com/a/16012/104963) to ask this question.

4
  • Don't do it that way - use lineno package.
    – Thruston
    May 6 '16 at 19:57
  • the problem is that lineno does not work for tabular lists e.g. when i make a description list. May 6 '16 at 20:03
  • lineno works fine for me with description lists. Please post a complete minimal working example that shows your problem.
    – Thruston
    May 6 '16 at 20:04
  • The numbers you get in that format are just for approximately pointing to a line, they aren't supposed to be “real” line numbers. For proof reading they are more than sufficient.
    – egreg
    May 6 '16 at 20:22
2

Use lineno package.

\documentclass{article}
\usepackage{lineno}
\usepackage{setspace}
\usepackage{lipsum}
\begin{document}
\linenumbers
\section*{Lorem Ipsum}
\setstretch{1.8}
\lipsum[2]
\end{document}

enter image description here

This will also work with the standard lists.

\documentclass{article}
\usepackage{lineno}
\usepackage{setspace}
\begin{document}
\linenumbers
\section*{Lorem Ipsum}
\setstretch{1.8}
\begin{description}
    \item[ALDF] Average annual load factor of a DT or HV substation
    \item[ALSF] Average annual loss factor of a DT or HV substation
    \item[APF] Average power factor
    \item[B] Number of all load blocks
\end{description}
\end{document}

enter image description here

And if you don't like the format of the standard lists you can always customize them. Here's one way to modify description to match the OP example. Adding this to the preamble of the second example:

\renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\makebox[1.27cm][l]{\itshape #1}}

gives this:

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.