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.

The problem:

I would like to create checklists for an aircraft. What I'm looking for is a way to create numbered descriptive lists with dot leaders.

Essentially, I want this, with numbers.

dot leaders


The Code:

I have this code, which I took from the above link:

\documentclass[12pt, letter]{article}

\newenvironment{specifications}{%
  \let\olditem\item%
  \renewcommand\item[2][]{\olditem##1\dotfill##2}%
  \begin{description}}{\end{description}% 
}

\begin{document}

\begin{specifications}
    \item[Input Voltage Range] 36-72 V DC
    \item[Input Current] 80 mA
    \item[Power over Ethernet] 802.3af-compliant Powered Device
\end{specifications}

\end{document}

I'm frankly not sure where to begin. I'm a novice with LaTeX - I'd prefer a simple answer to a complex one, but most of all I want to learn.

share|improve this question
1  
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Christian Hupfer Aug 14 at 21:29
    
Hi @ChristianHupfer - I've added the MWE, but I see that grayshade has already provided exactly what I needed. Thanks for the welcome, I'm sure I'll be back. –  Steve V. Aug 15 at 3:01

1 Answer 1

up vote 5 down vote accepted

Simply change the descripton environment for an enumerate environment:

\documentclass[12pt, letter]{article}

\newenvironment{specifications}{%
  \let\olditem\item%
  \renewcommand\item[2][]{\olditem##1\dotfill##2}%
  \begin{enumerate}}{\end{enumerate}% 
}

\begin{document}

\begin{specifications}
    \item[Input Voltage Range] 36-72 V DC
    \item[Input Current] 80 mA
    \item[Power over Ethernet] 802.3af-compliant Powered Device
\end{specifications}

\end{document}

output

As per Aditya's comment, the contained \renewcommand statement may be simplified to only one, compulsory argument, giving:

\documentclass[12pt, letter]{article}

\newenvironment{specifications}{%
  \let\olditem\item%
  \renewcommand\item[1]{\olditem##1\dotfill}%
  \begin{enumerate}}{\end{enumerate}% 
}

\begin{document}

\begin{specifications}
    \item{Input Voltage Range} 36-72 V DC
    \item{Input Current} 80 mA
    \item{Power over Ethernet} 802.3af-compliant Powered Device
\end{specifications}

\end{document}

Which of course provides the exact same output.

share|improve this answer
    
Why not simply define \renewcommand\item[1][]{\olditem##1\dotfill} without the ##2? –  Aditya Aug 15 at 5:13
    
@Aditya thanks for the suggestions - I was in fact keeping changes to the OPs MWE to a minimum. Trying to make the \renewcommand as easy to understand as possible, I guess one might also write \renewcommand\item[1]{\olditem##1\dotfill} making the argument compulsory and requiring to write \item{Description} Value. –  greyshade Aug 15 at 7:44

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.