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.

So I was wondering if there is the equivalent of itemsep for the subitems, particularly in the description environment. I know I could nest many environments one in the other but it seems ugly.

Exemple:

\begin{description}\itemsep2ex   
    \item[first item] \hfill\\
        \subitem \hfill\vspace{-1ex}\\
            some text
        \subitem \hfill\vspace{-1ex}\\
            some more text
        \subitem \hfill\vspace{-1ex}\\
            more text   
    \item[second item]
        \subitem some text 
\end{description}

This gives me what I want, but is there a way of replacing the 3 \vspace{-1ex} following the subitems by a general command for all the environment?

Thanks!

share|improve this question
1  
It's not clear what you're asking for. As you note, it's possible to have nested description environments, both in "standard" LaTeX as well as in conjunction with packages such as enumitem. Please consider revising your posting to include a MWE (minimum working example) of what you've done so far (and, possibly, what you're hoping to avoid). –  Mico Jun 1 '12 at 18:11
    
@Mico Sorry, just updated –  Zenon Jun 1 '12 at 18:26
    
Ugliness is in the eye of the beholder. Having nested lists is semantically well behaved whereas having a \subitem command abuses the semantics. Most editors support environment completion or macros that can speed up the inputting of the semantically well-formed source. –  Alan Munn Jun 1 '12 at 18:28
    
@AlanMunn I said it seems ugly :). I don't know enough about LaTeX formatting standarts. If the community agrees I would gladly accept this as an answer. (By the way I am using TeXShop/vim and sometimes Kyle, any known manual on how to automate this kind of behavior?) –  Zenon Jun 1 '12 at 18:36
add comment

2 Answers

up vote 5 down vote accepted

With the help of the enumitem package, it's straightforward to set different fonts and font shapes for the labels of items of varying hierarchical levels in a description list. The following MWE keeps the default for labels of level-1 description items (bold) but uses non-bold italics for the labels of level-2 description items. (If you wanted to use plain non-italics for the labels of level-2 description items, just leave off the \itshape directive.) Hopefully you can find some combination of font shapes and weights which doesn't strike you as ugly...

\documentclass{article}
\usepackage{enumitem}
\setlist[description,2]{font=\normalfont\itshape} % non-bold italics
\begin{document}
\section{Hello}
\begin{description}
  \item[First item] Initial thoughts \ldots
  \begin{description}
    \item[Preliminaries] The quick brown fox jumps \ldots
    \item[Further stuff] \ldots\ over the lazy dog.
  \end{description}
  \item[Second item] Further thoughts \ldots
\end{description}
\end{document}

enter image description here

share|improve this answer
    
More great packages... thanks! That is pretty neat too. –  Zenon Jun 1 '12 at 19:51
add comment

Well, you could define a custom \MySubitem:

\def\MySubitem{\subitem \hfill\vspace{-1ex}\\ }

and then use \MySubitem when you want the \hfill\vspace{-1ex}\\ applied and the regular \subitem when you don't want it applied (as in your last usage). So with the MWE below you get output as your example:

enter image description here

Notes:

  • If you always wanted the same behavior, you could just redefine \subitem:

    \let\OldSubItem\subitem
    \def\subitem{\OldSubItem \hfill\vspace{-1ex}\\ }
    

    I did this originally but then saw that you were not applying your tweak to you last usage of \subitem.

Warning:

  • This is an abuse of \subitem. As egreg commented below \subitem is an internal command for typesetting the index and is not intended to be used in this manner.

Code:

\documentclass{article}

\def\MySubitem{\subitem \hfill\vspace{-1ex}\\ }

% If you want to redefine \subitem uncomment the following:
% \let\OldSubItem\subitem%    
% \def\subitem{\OldSubItem \hfill\vspace{-1ex}\\ }

\begin{document}
\begin{description}\itemsep2ex 
    \item[first item] \hfill\\
        \subitem \hfill\vspace{-1ex}\\
            some text
        \subitem \hfill\vspace{-1ex}\\
            some more text
        \subitem \hfill\vspace{-1ex}\\
            more text   
    \item[second item]
        \subitem some text 
\end{description}
\end{document}
share|improve this answer
    
This is quite nice. May I ask why you use the \let before the \def? –  Zenon Jun 1 '12 at 19:07
    
That was left over form my first version where I was redefining \item. I have added a commented version to show how that could be used. –  Peter Grill Jun 1 '12 at 19:12
1  
You're abusing \subitem which is an internal command for typesetting the index (it expands to \@idxitem\hspace*{20pt}). And \@idxitem uses \hangindent which doesn't go along with list environments that use \parshape: mixing the two is a sure source of headache. In the LaTeX manual, \subitem is mentioned only in connection with indexes. –  egreg Jun 1 '12 at 21:24
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.