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

TITLESEC: problem with aligning paragraphs headings using leftmargin option

59 views
Skip to first unread message

mcforgi

unread,
Aug 20, 2010, 4:50:27 PM8/20/10
to
Hi everybody,

when I use the TITLESEC-package to for leftmargin paragraph headings,
this headings will align perfectly with normal text, but they won't
align with an equation- or an itemize-environment in the first line.
How do I make them align?

See this pdf for a visualisation of the problem:
http://www.scribd.com/doc/36184235/Titlesec-Paragraph-Left-Margin

Code:
\documentclass[]{article}

\usepackage{geometry}
\geometry{a4paper,left=9cm,right=3cm, top=2cm, bottom=3cm}

\usepackage{titlesec}
\titleformat{\paragraph}[leftmargin]{\normalfont\vspace{14pt}\sffamily
\filleft}{\theparagraph}{0em}{}[]
\titlespacing{\paragraph}{15pc}{-0.5pc}{1pc}

\begin{document}
\paragraph{Was versteht man unter einer Draisine bzw. einer
Laufmaschine?}
Die Draisine oder Laufmaschine (so auch der vom Erfinder verwendete
Name) ist ein einspuriges, von Menschenkraft betriebenes Fahrzeug ohne
Pedale, das als Urform des heutigen Fahrrads gilt.
\paragraph{Wie viel ist dreizehn mal acht?}
\begin{equation}
7\times8=8+8+8+8+8+8+8+8+8+8+8+8+8=56
\end{equation}

\paragraph{Aus welchen Zutaten besteht Schokolade?}
\begin{itemize}
\item Kakao
\item Milch
\item Zucker
\end{itemize}

\end{document}

Thanks for any ideas,
Mcforgi

jon

unread,
Aug 20, 2010, 5:23:14 PM8/20/10
to
On Aug 20, 4:50 pm, mcforgi <mcfo...@yahoo.com> wrote:
> when I use the TITLESEC-package to for leftmargin paragraph headings,
> this headings will align perfectly with normal text, but they won't
> align with an equation- or an itemize-environment in the first line.
> How do I make them align?

> Code:

for the itemize environment, use:

\usepackage{enumitem}
\setitemize{leftmargin=*}
% see the documentation for more options

(don't use math stuff, so i can't help, but i'm sure there are a
number of ways to do this.)

cheers,
jon.

mcforgi

unread,
Aug 21, 2010, 3:00:11 AM8/21/10
to
Thanks for the quick answer Jon. Your suggestion doesn't work, though.
It is not a question of what itemize-environment you use but it is
really a problem of the titlesec-package.

Any more ideas?

Robin Fairbairns

unread,
Aug 21, 2010, 3:43:49 AM8/21/10
to
mcforgi <mcf...@yahoo.com> writes:

not so. both itemize and equation-type environments include _in
themselves_ vertical space above and below, which explains what you
see. quite why scrunching the top skip of itemize doesn't have the
required effect, i'm not sure. possibly \leavevmode before the itemize
would help (particularly if you're using hyperref)

> Any more ideas?

apart from that rather feeble offering, no.
--
Robin Fairbairns, Cambridge

Message has been deleted

mcforgi

unread,
Aug 21, 2010, 5:34:55 AM8/21/10
to
Thanks Robin. Despite your ideas the problem still isn't solved
though. Here are two follow-up-questions:

> possibly \leavevmode before the itemize
> would help (particularly if you're using hyperref)

1) I won't be using hyperref, but for the itemize-environment I tried
this:

\begin{itemize}
\leavevmode


\item Kakao
\item Milch
\item Zucker
\end{itemize}

Question: What is the correct way to put \leavevmode into the code,
for example into an itemize environment? Couldn't find this on google.

> both itemize and equation-type environments include _in
> themselves_ vertical space above and below, which explains what you
> see. quite why scrunching the top skip of itemize doesn't have the
> required effect,

2) Intending to eliminate this "in_themselves_ vertical_space_above"
you are talking about, I added \setlength{\topsep}{0pt} and
\setlength{\partopsep}{0pt}
to the code, but this did not have any effect. I think spacing isn't
the problem here. The problem is the fact that in latex, there is a
line break after \paragraph{} for everything but plain text, which
wraps around the title of the paragraph. See http://radfelder.de/latex/dok7.gif
for example.

Question: Is there a way to prevent this linebreak?

Thanks,
Mcforgi

Robin Fairbairns

unread,
Aug 21, 2010, 8:04:29 AM8/21/10
to
mcforgi <mcf...@yahoo.com> writes:

> Thanks Robin. Despite your ideas the problem still isn't solved
> though. Here are two follow-up-questions:
>
>> possibly \leavevmode before the itemize
>> would help (particularly if you're using hyperref)
>
> 1) I won't be using hyperref, but for the itemize-environment I tried
> this:
>
> \begin{itemize}
> \leavevmode
> \item Kakao
> \item Milch
> \item Zucker
> \end{itemize}
>
> Question: What is the correct way to put \leavevmode into the code,

no. every \item command includes a \par, so the effect of that
\leavevmode (if any) would be squashed by the followin \item command.

> for example into an itemize environment? Couldn't find this on google.

i did say _before_ the itemize, by which i meant

\leavevmode
\begin{itemize}
...

please try it as i suggested.

>> both itemize and equation-type environments include _in
>> themselves_ vertical space above and below, which explains what you
>> see. quite why scrunching the top skip of itemize doesn't have the
>> required effect,
>
> 2) Intending to eliminate this "in_themselves_ vertical_space_above"
> you are talking about, I added \setlength{\topsep}{0pt} and
> \setlength{\partopsep}{0pt}

\partopsep, i think, actually has an effect, but ought not to be
exercised if you've used \leavevmode as i suggested. \topsep is set to
the "proper value" inside the list, by the list itself. this is why you
need to use enumitem, with its neat facilities for hacking list
parameters. (of course, you can also read the source of latex and work
out what you need to do from that. i don't recommend it.)

list parameters are notoriously tricky to set.

> to the code, but this did not have any effect. I think spacing isn't
> the problem here. The problem is the fact that in latex, there is a
> line break after \paragraph{} for everything but plain text, which
> wraps around the title of the paragraph. See http://radfelder.de/latex/dok7.gif
> for example.
>
> Question: Is there a way to prevent this linebreak?

let's see, after you've tried \leavevmode
--
Robin Fairbairns, Cambridge

0 new messages