LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

`\bigskip` in section title incorrectly inserts `<break/>`

Open nschloe opened this issue 2 years ago • 4 comments
trafficstars

MWE:

\documentclass{article}
\begin{document}

\section{\bigskip Introduction}

\end{document}

LaTeX output:

screenshot_2023-10-30-205902

LaTeXML output:

  <section inlist="toc" xml:id="S1">
    <tags>
      <tag>1</tag>
      <tag role="refnum">1</tag>
      <tag role="typerefnum">§1</tag>
    </tags>
    <title><tag close=" ">1</tag><break/>Introduction</title>
  </section>

nschloe avatar Oct 30 '23 19:10 nschloe

This almost looks like a feature to me - the author asked for a skip, and the request was honored.

I think you can easily add a CSS rule that styles these breaks with display:none; whenever they are undesired, right?

We should also be mindful that this example is dangerously close to "markup abuse", where many treatments would be equally good/bad.

dginev avatar Oct 30 '23 20:10 dginev

I'd been under the impression that LaTeXML tries to replicate LaTeX as closely as possible. LateX ignores \bigskip in titles. ⟹ So does LaTeXML.

I think you can easily add a CSS rule that styles these breaks with display:none; whenever they are undesired, right?

You can actually produce newlines in titles with

\section{\\Introduction}

screenshot_2023-10-30-212029

In LaTeXML, this correctly gives

<title><tag close=" ">1</tag><break/>Introduction</title>

Ignoring <break/>s in titles would also ignore those rightful linebreaks.

nschloe avatar Oct 30 '23 20:10 nschloe

I'd been under the impression that LaTeXML tries to replicate LaTeX as closely as possible.

We also try to be semantics-preserving as closely as possible, and sometimes layout and semantics clash. We usually favor semantics in such cases.

But maybe there is a good reason why \bigskip is ignored in this context and we should too - would need to read more about how it gets dropped in LaTeX-proper to be sure.

dginev avatar Oct 30 '23 21:10 dginev

FWIW, it was my impression that the authors mistakenly wanted to create a vertical "big skip" between 1 and Introduction, and they thought \bigskip does this (while really LaTeX does it automatically).

nschloe avatar Oct 31 '23 08:10 nschloe