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

Latex: terms are not separated by a newline #9985

Closed
marxin opened this issue Dec 17, 2021 · 4 comments
Closed

Latex: terms are not separated by a newline #9985

marxin opened this issue Dec 17, 2021 · 4 comments
Labels
builder:latex type:proposal a feature suggestion
Milestone

Comments

@marxin
Copy link
Contributor

marxin commented Dec 17, 2021

Describe the bug

I use simple indentations for terms and their explanation:

Example:

Listing:

:samp:`{file}.cc` :samp:`{file}.cp` :samp:`{file}.cxx` :samp:`{file}.cpp` :samp:`{file}.CPP` :samp:`{file}.c++` :samp:`{file}.C`
  C++ source code that must be preprocessed.  Note that in :samp:`.cxx`,
  the last two letters must both be literally :samp:`x`.  Likewise,
  :samp:`.C` refers to a literal capital C.

:samp:`{file}.mm` :samp:`{file}.M`
  Objective-C++ source code that must be preprocessed.

:samp:`{file}.mii`
  Objective-C++ source code that should not be preprocessed.

:samp:`{file}.hh` :samp:`{file}.H` :samp:`{file}.hp` :samp:`{file}.hxx` :samp:`{file}.hpp` :samp:`{file}.HPP` :samp:`{file}.h++` :samp:`{file}.tcc`
  C++ header file to be turned into a precompiled header or Ada spec

Which results in the following HTML output:

Alabaster:

Screenshot from 2021-12-17 12-49-36

RTD theme:

Screenshot from 2021-12-17 12-49-50

While xelatex output does not contain a new line:

Screenshot from 2021-12-17 12-50-53

@jfbu

How to Reproduce

Build the snippet.

Expected behavior

No response

Your project

Build the snippet

Screenshots

No response

OS

Linux

Python version

3.8

Sphinx version

4.3.0

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

@tk0miya tk0miya added builder:latex type:proposal a feature suggestion and removed type:bug labels Dec 18, 2021
@tk0miya
Copy link
Member

tk0miya commented Dec 18, 2021

I don't think this is not a bug. It's not promised a term and description of the definition list are displayed as line-folded.

But I agree it's better to fold them as HTML does.

@marxin
Copy link
Contributor Author

marxin commented Dec 18, 2021

Great, thanks for the suggested pull request!

@jfbu
Copy link
Contributor

jfbu commented Dec 18, 2021

@marxin It may take some time before a solution is found because the natural #9988 approach breaks some numpy's LaTeX hack. As a work-around you may try to add to your project their hack

latex_elements = {
    'preamble': r'''
% In the parameters section, place a newline after the Parameters
% header
\usepackage{expdlist}
\let\latexdescription=\description
\def\description{\latexdescription{}{} \breaklabel}
% but expdlist old LaTeX package requires fixes:
% 1) remove extra space
\usepackage{etoolbox}
\makeatletter
\patchcmd\@item{{\@breaklabel} }{{\@breaklabel}}{}{}
\makeatother
% 2) fix bug in expdlist's way of breaking the line after long item label
\makeatletter
\def\breaklabel{%
    \def\@breaklabel{%
        \leavevmode\par
        % now a hack because Sphinx inserts \leavevmode after term node
        \def\leavevmode{\def\leavevmode{\unhbox\voidb@x}}%
    }%
}
\makeatother
''',
}

I am not completely happy with the resulting looks (see #9988 (comment)) but it may serve temporarily.

jfbu added a commit that referenced this issue Dec 23, 2021
LaTeX: separate terms from their definitions by a CR (close #9985)
@jfbu jfbu modified the milestones: 4.4.0, 5.0.0 Dec 23, 2021
@jfbu
Copy link
Contributor

jfbu commented Dec 23, 2021

Closed via 9e8e3f9 (#9999)

@jfbu jfbu closed this as completed Dec 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
builder:latex type:proposal a feature suggestion
Projects
None yet
Development

No branches or pull requests

3 participants