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.

In the document below an itemize is nested in a description and I want to have no vertical space between the entries.

I removed the space above and below of itemizes and descriptions using \vskip-\parskip, but this might not be the right way. And it does not work if the itemize is the first content inside a description.

I tried to use the joinedup and nowhite as shown here, but then the spacing still exists.

How to remove the space above/below itemizes and descriptions?

Code:

\definedescription[description][
    alternative=left,
    width=2em,
    before={\vskip-\parskip},  %<<< ?
    after={\vskip-\parskip},   %<<< ?
]

\setupitemize[each][packed][   % [joinedup,nowhite] don't change spacing
    before={\vskip-\parskip},  %<<< ?
    after={\vskip-\parskip},   %<<< ?
]

\starttext

    \startdescription{Foo}
        \input knuth
    \stopdescription

    \startdescription{Bar}
        \startitemize
        \item ↑ Too much space above ↑
        \item Just some Text
        \item Just some Text
        \stopitemize
    \stopdescription

    \startdescription{Baz}
        A line that contains some text. A line that contains some text. A line that contains some text. 
        \startitemize
        \item Just some Text
        \item Just some Text
        \item Just some Text
        \stopitemize
        A line that contains some text. A line that contains some text. A line that contains some text. 
    \stopdescription

\stoptext

Result:

output document

Used ConTeXt version is 2013.05.28 00:36.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

ConTeXt does remove such spaces when you use nested itemize, for example

\startitemize
  \item 
    \startitemize
      \item One
      \item Two
    \stopitemize
\stopitemize

but there is no high level interface for this. However, it is easy to provide a wrapper around the low level commands

\unprotect
\define\concatitemgroup{\hskip\d_strc_itemgroups_signal}
\protect

and then use

\startdescription{Bar}
  \concatitemgroup
  \startitemize
    \item ↑ Too much space above ↑
    \item Just some Text
    \item Just some Text
  \stopitemize
\stopdescription

Unfortunately, you cannot use

\startitemize[before=\concatitemgroup]

because the before is triggered too late in \startitemize. For automatically workflow, you can define your own description rendering setup.

\unprotect
\startsetups[\??constructionrenderings:leftconcat]
    \directsetup{\??constructionrenderings:\v!left:\v!none}
    \hskip\d_strc_itemgroups_signal
\stopsetups

\defineconstructionalternative
  [leftconcat]
  [\c!renderingsetup=\??constructionrenderings:leftconcat]

\def\concatitemgroup{\hskip\d_strc_itemgroups_signal}

\protect

\definedescription
  [description]
  [
    alternative=leftconcat,
    width=2em,
  ]

\setupitemize[packed]

\starttext
    \startdescription{Bar}
      \startitemize
        \item ↑ Too much space above ↑
        \item Just some Text
        \item Just some Text
      \stopitemize
    \stopdescription

    \startdescription{Baz}
        A line that contains some text. A line that contains some text. A line that contains some text. 
        \startitemize
        \item Just some Text
        \item Just some Text
        \item Just some Text
        \stopitemize
        A line that contains some text. A line that contains some text. A line that contains some text. 
    \stopdescription
  \stoptext

which gives

enter image description here

For no vertical space, simply add

\setupitemize[nowhite]
share|improve this answer
    
Thanks, this works well. Is it advisable to use \vskip-\parskip in \definedescription to remove space between description entries or is there some more "official way"? –  hiddenbit Aug 29 '13 at 17:45

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.