Skip to content

Conversation

@jfbu
Copy link
Contributor

@jfbu jfbu commented Jan 28, 2021

Adds multicol LaTeX package requirement, but it is a required
part of any latex distribution.

(hence I make the PR on 3.x branch)

I think this is bugfix as #8072 was tagged as "bug" :)

I used following test file
index.rst.txt
to check it was possible to use hlist inside a table, or inside another list (I checked only a hlist, but this is only more stringent).

In the test output one sees some phenomenon related to the fact that LaTeX does not hyphenate the first word of a paragraph. This shows here with the word "horizontally" in narrow columns. The non-hyphenated word gets then shifted down...

But this has nothing to do with this PR and I will make another one to address the issue. The bullets in the output may look random but they do match the input which I constructed by random copy paste and adding and suppressing item separators.

Capture d’écran 2021-01-28 à 21 24 38

Relates

Adds ``multicol`` LaTeX package requirement, but it is a required
part of any latex distribution.
.. versionadded:: 0.6

.. versionchanged:: 3.5.0
support by the latex builder.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be 3.5 not 3.5.0? And should I capitalize: "Support", not "support"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are okay, but I usually use 3.5 and "Support" (no reason and rules :-p)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I did not noticed this is a changes of hlist directive. I don't think this changelog is needed because of this change does not modify the feature of the directive itself.

jfbu added a commit to jfbu/sphinx that referenced this pull request Jan 29, 2021
Else, a non-hyphenatable long word as first word in a narrow column in a
longtable/tabular (with column type e.g. p{1cm} from tabularcolumns
directive) gets shifted downwards vertically in PDF output.

Memo:

1. I did not find other cases where such a vertical shift may occur (I
tried with deeply nested lists and artificial words such as 'A'*32) with
LaTeX mark-up produced by Sphinx,

2. but with the support of hlist directive via PR sphinx-doc#8779 using multicols
environment, there is again this situation of downwards shift of
non-hyphenatable long first words.  But it occurs whether or not
\sphinxAtStartPar is used (\nobreak does not modify this).
@jfbu
Copy link
Contributor Author

jfbu commented Jan 29, 2021

LaTeX (except lualatex engine) does not hyphenate first word of a paragraph (see #8780). So with this PR, the input

.. hlist::
   :columns: 6

   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally
   * horizontally

currently renders as (a4paper):
Capture d’écran 2021-01-29 à 13 56 35

With #8781 merged it will render rather as:
Capture d’écran 2021-01-29 à 13 57 26

However, if in this example horizontally is replaced by a word that TeX does not know how to hyphenate such as aaaaaaaaaaaa, then, even with #8781, the downward shift seen in first picture above will occur. I have no fix for that at this time.

Copy link
Member

@tk0miya tk0miya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jfbu
Copy link
Contributor Author

jfbu commented Jan 29, 2021

Thanks for review @tk0miya as always. I tested that the used LaTeX multicols environment (from multicol package) can be used with no problem in nested lists. One can even nest an hlist inside another hlist. It is ok also inside table cells (triggering the table.has_problematic like other lists). Thus I feel this is not breaking change but new feature, hence now merging!

@jfbu jfbu merged commit be20f17 into sphinx-doc:3.x Jan 29, 2021
@jfbu jfbu deleted the latex_hlist_support branch January 29, 2021 20:07
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants