0

This is my document:

\documentclass{article}

% \usepackage{enumitem}
% \setlist[description]{style=nextline}


\usepackage{titlesec}
\titleformat{name=\subsection}[leftmargin]
{\normalfont\itshape\filleft}
{}{0pt}{}

\titlespacing{\subsection}
{6pc}{1.5ex plus .1ex minus .2ex}{1pc}

\parindent0pt

\begin{document}

\section{dummy}

\subsection{first}
some text, looks ok

\subsection{second}
% what can insert here to make the description appear higher?
\begin{description}
  \item[foo] bar
  \item[bar] baz
\end{description}

\end{document}

which results in enter image description here

There is too much spacing above the description environment (foo - bar). I'd like it to have it on the same line as the subsection title, similar to the first section title.

Q: how can I remove the vertical space above the description environment?

In my real document I use the enumitem package, if this is important.

A "manual solution" would be fine with me, such as "always insert macro ... before the \begin{description}"

0

1 Answer 1

3

This here should work. But it relies on the assumption that there is no large object in the first line:

\documentclass{article}

 \usepackage{enumitem}
 \setlist[description]{style=nextline}


\usepackage{titlesec}
\titleformat{name=\subsection}[leftmargin]
{\normalfont\itshape\filleft}
{}{0pt}{}

\titlespacing{\subsection}
{6pc}{1.5ex plus .1ex minus .2ex}{1pc}

\parindent0pt

\usepackage{tikz}
\begin{document}

\section{dummy}

\subsection{first}
some text, looks ok

\subsection{second}
% what can Insert here to make the description appear at the start of the line?
\begin{description}[topsep=0pt,before=\leavevmode\vspace{-\baselineskip}]
  \item[foo] b\tikz[overlay]\draw[red](0,0) --++(-10,0);bar
  \item[bar] baz
\end{description}

\end{document}

enter image description here

1
  • This works perfectly! Thanks. At first I was shocked that tikz was necessary, but that's only to draw the red line. I'll never understand these \leavevmode and such...
    – topskip
    Mar 8, 2017 at 9:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .