Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

largestsep does not work as advertised #27

Open
RuixiZhang42 opened this issue Apr 25, 2020 · 1 comment
Open

largestsep does not work as advertised #27

RuixiZhang42 opened this issue Apr 25, 2020 · 1 comment
Labels

Comments

@RuixiZhang42
Copy link

Brief description of the bug

With package option largestsep, titlesec does not use the larger skip, but instead use the sum of <after-sep> from the first heading and <before-sep> from the second heading.

MWE demonstrating the issue

MWE adapted from https://tex.stackexchange.com/q/269484 with more exaggerated spacing:

\documentclass{article}
\usepackage{lipsum}
\usepackage[largestsep]{titlesec}
\titlespacing{\section}   {0pt}{20pt}{20pt}
\titlespacing{\subsection}{0pt}{20pt}{10pt}
\begin{document}
Expected:

\vskip20pt

\Large Section

\vskip20pt

\large Subsection

\vskip10pt

\normalsize \lipsum[1][1-5]

\noindent
\hrulefill

Actual:
\section{Section}
\subsection{Subsection}
\lipsum[1][1-5]
\end{document}

largestsep

Possible fixes

titlesec uses \vspace to add <after-sep>, and this is the bug.

In the LaTeX2e kernel \vspace{#1} expands to ... \vskip #1 \vskip\z@skip ..., so when the next <before-sep> appears in \ttl@titlespace{<before-sep>} (since \let\ttl@titlespace\addvspace in this case), the \addvspace acts on \z@skip and not the intended <after-sep>.

@jbezos
Copy link
Owner

jbezos commented Jun 16, 2020

Thank you for the report and for the fix (and sorry for the late answer). I'll try to release a new version it in a few weeks.

@jbezos jbezos added the bug label Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants