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: long words in narrow columns may not be hyphenated #8780

Closed
jfbu opened this issue Jan 28, 2021 · 0 comments
Closed

LaTeX: long words in narrow columns may not be hyphenated #8780

jfbu opened this issue Jan 28, 2021 · 0 comments

Comments

@jfbu
Copy link
Contributor

jfbu commented Jan 28, 2021

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):

Capture d’écran 2021-01-28 à 21 48 36

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)

@jfbu jfbu added this to the 3.5.0 milestone Jan 28, 2021
@jfbu jfbu closed this as completed in 185a2d2 Jan 29, 2021
jfbu added a commit that referenced this issue Jan 29, 2021
Fix #8780: long words in narrow columns may not be hyphenated
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant