Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

customizing a description list

34 views
Skip to first unread message

Haines Brown

unread,
Sep 16, 2016, 12:59:55 PM9/16/16
to
For a list of recommended readings at the end of book chapters I'm using
a customized description list.

\section{Recommended Reading}
\begin{description} \small \setlength{\itemsep}{-0.2cm}
\item[\parbox{\textwidth}
{This is first citation and it takes only one line}]\hfill\\[-1ex]
Commentary text...
\item[\parbox{\textwidth}
{This is second citation and it takes up two lines}\hfill\\[-1ex]
Commentary text...
\end{description}

The problem is that while the separation between the label and
descriptive text [-1ex] of the second item is what I want, the space
between label and description of the first item is too big.

How can I have the separation between labels and descriptions be the
same for each item regardless of the number of lines required for the
label?

Perhaps I'm making things too difficult for myself by relying on a
descriptive list. Are there better ways to go about this?

Haines Brown

Axel Berger

unread,
Sep 16, 2016, 4:52:08 PM9/16/16
to
Haines Brown wrote:
> \section{Recommended Reading}
> \begin{description} \small \setlength{\itemsep}{-0.2cm}
> \item[\parbox{\textwidth}
> {This is first citation and it takes only one line}]\hfill\\[-1ex]
> Commentary text...
> \item[\parbox{\textwidth}
> {This is second citation and it takes up two lines}\hfill\\[-1ex]
> Commentary text...
> \end{description}

This is not a working MWE. It's incomplete and there's a ] missing. I
have no idea what you'r trying to acieve, what I get looks terrible.

a) Look at the vertical alignment of parbox.
b) If the parbox has textwidth, a \hfill has to be meaningless or yield
unintended results.

In the following I don't quite like what I see, but it may come near to
what you intended.

\documentclass{scrartcl}
\usepackage[x-atarist]{inputenx}
\usepackage[resetfonts]{cmap}
\usepackage[T1]{fontenc}
\usepackage{calc}

\begin{document}

\section{Recommended Reading}
\begin{description} \small %\setlength{\itemsep}{-0.2cm}
\item[{\parbox[b]{\textwidth-.5em}
{This is first citation and it takes only one line}}]~\\
Commentary text... Commentary text... Commentary text... Commentary
text... Commentary text... Commentary text... Commentary text...
Commentary text... Commentary text... Commentary text... Commentary
text... Commentary text... Commentary text... Commentary text...
Commentary text... Commentary text... Commentary text...
\item[{\parbox[b]{\textwidth-.5em}
{This is second citation and it takes up two lines This is second
citation and it takes up two lines}}]~\\
Commentary text... Commentary text... Commentary text... Commentary
text... Commentary text... Commentary text... Commentary text...
Commentary text... Commentary text... Commentary text... Commentary
text... Commentary text... Commentary text... Commentary text...
Commentary text... Commentary text...

\end{description}

\end{document}

Axel

--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --

jjto...@gmail.com

unread,
Sep 16, 2016, 7:42:12 PM9/16/16
to
Haines Brown wrote:
> For a list of recommended readings at the end of book chapters I'm using
> a customized description list.
>
> \section{Recommended Reading}
> \begin{description} \small \setlength{\itemsep}{-0.2cm}
> \item[\parbox{\textwidth}
> {This is first citation and it takes only one line}]\hfill\\[-1ex]
> Commentary text...
> \item[\parbox{\textwidth}
> {This is second citation and it takes up two lines}\hfill\\[-1ex]
> Commentary text...
> \end{description}
>

I would use the enumitem package, as the following minimal example suggests:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{lipsum}

\usepackage{enumitem}

\begin{document}

\section{Recommended Reading}

\begin{description}[style=nextline, noitemsep]
\item[This is first citation and it takes only one line]
\lipsum[1]

\item[This is second citation and it takes up two lines.
This is second citation and it takes up two lines]
\lipsum[2]
\end{description}

\end{document}

Kind regards

Juanjo

Haines Brown

unread,
Sep 18, 2016, 9:16:19 AM9/18/16
to
Axel, your suggestion was much appreciated. The problem is that using
KOMA script really changes the format of the entire document and would
require a lot of tinkering to get it back to what I want.

I couldn't get your suggestion to compile without changing it a bit.

Haines

Haines Brown

unread,
Sep 18, 2016, 9:18:29 AM9/18/16
to
Juanjo,

I was unaware of nextline style for description list, and your
suggestion is not only simple but worked out perfectly. Thank you.

Haines

Axel Berger

unread,
Sep 18, 2016, 12:57:13 PM9/18/16
to
Haines Brown wrote:
> I couldn't get your suggestion to compile without changing it a bit.

Yes, sorry about that. The
\usepackage[x-atarist]{inputenx}
was a silly leftover from something else I'd done. Should have seen
that. There was nothing Koma-specific in the file, so substituting
article and making the head:

\documentclass{article}
\usepackage[cp1252]{inputenc}
\usepackage[resetfonts]{cmap}
\usepackage[T1]{fontenc}
\usepackage{calc}

made it run fine here.
0 new messages