-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
For many years, LaTeX had a problem that the first word in a table cell could not be hyphenated. Recent LaTeX relases have fixed that but it remains a general fact that TeX does not (without extra mark-up) hyphenate the first word of a paragraph.
Edited:
I don't know where from I got the idea that recent LaTeX hyphenates the first word of a table cell without help, this is wrong.
Generally speaking TeX does not hyphenate the first word of a paragraph. This may be a problem in narrow table cells.
Package tabulary does it automatically (this shows in the picture below for the first table). But:
- This is not the case for tabular and longtable (as one can test).
- Even tabulary can have a problem if the cell content is a list, as one sees in the second table below.
- They are are other circumstances than table cells than can lead to narrow widths.
To Reproduce
Use following
Welcome to FOO's documentation!
===============================
Test non hyphenated first word
------------------------------
.. csv-table:: hyphenation works with *recent* LaTeX for first word in table cell
horizontally, horizontally, horizontally, horizontally, horizontally, horizontally, horizontally, horizontally
.. tabularcolumns:: |p{1cm}|p{2cm}|
.. table:: but there is still problem if the cell contains a list
==== ====
A B
==== ====
1 - horizontally
- horizontally
- horizontally
- horizontally
- horizontally
- horizontally
- horizontally
- horizontally
==== ====
Here is the output with recent LaTeX (with LaTeX from a few years ago also table 1 will have a problem edited, that was wrong comment; the table 1 is fine only because rendered by tabulary):
In the table 2, the non hyphenated word also causes a vertical shift downward.
Expected behavior
First word of paragraph hyphenates if in narrow context such as a table. (other contexts can give this)
Environment info
- OS: [e.g. Unix/Linux/Mac/Win/other with version]
- Python version: [e.g. 3.7.1]
- Sphinx version: 3.x
- Sphinx extensions: [e.g. sphinx.ext.autodoc, recommonmark]
- Extra tools: TeXLive 2020
Additional context
With the support of hlist directive by PR #8779, this problem is more likely to show (because it will not benefit from the LaTeX special fix for tables). In fact I became aware of it from testing #8779. I had already encountered the problem in Sphinx own docs, which I fixed by manual insertion (see the raw latex inside file https://github.com/sphinx-doc/sphinx/blob/57126d9ee2400ecd584565a262c909e4adc156f0/doc/extdev/deprecated.rst)
