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

is the extra space at the start of LaTeX footnotes intentional ? (may stretch and give bad result) #2351

Closed
jfbu opened this issue Feb 24, 2016 · 8 comments
Milestone

Comments

@jfbu
Copy link
Contributor

jfbu commented Feb 24, 2016

Consider the following index.rst:

========================
Bad spacing in footnotes
========================

Requirements:

 * `a short url
   <http://www.sphinx-doc.org/>`_.

 * `a long url
   <https://en.wikipedia.org/w/index.php?title=Special:Search&search=some+examples-of-extremely-extremely-extremely-extremely-extremely+very+long+URLs>`_.

 * `a short url
   <http://www.sphinx-doc.org/>`_.

and in conf.py::

# If true, show URL addresses after external links.
latex_show_urls = 'footnote'

I get from make latexpdf

capture d ecran 2016-02-24 a 10 32 12

This may seem a contrived example, but it occurred to me in real life from auto-generated links via intersphinx, and the use of 12pt font size, and a font with rather big glyphs. In the example above I inserted - to give a chance for the URL to break. This was the case of the auto-generated link in my real life case.

The problem is with the extra space token which comes from the \footnote's in the latex file: (tested on current master)

Requirements:
\begin{itemize}
\item {} 
\href{http://www.sphinx-doc.org/}{a short url}\footnote[1]{
http://www.sphinx-doc.org/
}.

\item {} 
\href{https://en.wikipedia.org/w/index.php?title=Special:Search\&search=some+examples-of-extremely-extremely-extremely-extremely-extremely+very+long+URLs}{a long url}\footnote[2]{
https://en.wikipedia.org/w/index.php?title=Special:Search\&search=some+examples-of-extremely-extremely-extremely-extremely-extremely+very+long+URLs
}.

\item {} 
\href{http://www.sphinx-doc.org/}{a short url}\footnote[3]{
http://www.sphinx-doc.org/
}.

\end{itemize}

Is it intentional not to have \footnote[1]{% ? without it a space comes from the end of line. If one wants a space there, one should make it un-stretchable \footnote[1]{\mbox{ }%.

Here is without spaces (standard looks of american typography footnotes):

capture d ecran 2016-02-24 a 10 32 47

and here is with \mbox{ }%:

capture d ecran 2016-02-24 a 10 34 04

tk0miya added a commit that referenced this issue Mar 2, 2016
@tk0miya
Copy link
Member

tk0miya commented Mar 2, 2016

Thank you for reporting. I fixed at 6efdd07. (I used mbox for spacing)

@tk0miya tk0miya closed this as completed Mar 2, 2016
@tk0miya tk0miya added this to the 1.4 milestone Mar 2, 2016
@jfbu
Copy link
Contributor Author

jfbu commented Mar 2, 2016

@tk0miya Thanks. I should have pointed out perhaps that arguably leaving the LaTeX default (no special spacing) was to be advised. Indeed some language modules for (LaTeX) babel customize this: I know in particular of French http://mirrors.ctan.org/macros/latex/contrib/babel-contrib/french/frenchb.pdf, which modifies footnotes to look like "1.<space>text" (see its default option FrenchFootnotes). Thus with the extra \mbox{ } this gives two spaces. I understand that English footnotes with the extra \mbox{ } look better (after all the French do it by default... plus the dot after the footnote number), but the LaTeX default does not have it. Probably there are LaTeX packages (I didn't check: http://ctan.org/topic/footnote) that English-speaking users can add to the preamble to modify the default looks if they want to. But the default LaTeX looks based on traditional English-speaking typography has no extra space. I should have made this clearer in my issue description sorry.

@jfbu
Copy link
Contributor Author

jfbu commented Mar 2, 2016

A possibility would be for the latex builder to insert \sphinxAtStartFootnote macro rather than \mbox{ }. The sphinx.sty would then have \newcommand*\sphinxAtStartFootnote{\mbox{ }}, and this could be overwritten by user in conf.py using 'preamble' key.

As a general remark all macros defined in sphinx.sty should have a unique distinctive prefix, I used sphinx above. In LaTeX using macro names without prefix may easily lead to conflict if additional packages are loaded by user.

@tk0miya
Copy link
Member

tk0miya commented Mar 2, 2016

@jfbu Thank you for advice. I added the \sphinxAtStartFootnote macro now :-)

@jfbu
Copy link
Contributor Author

jfbu commented Mar 2, 2016

@tk0miya Works great, thank you !

@jnothman
Copy link
Contributor

jnothman commented Jun 8, 2016

At master, I'm getting code generated like:

dimensions \footnote[8]{\sphinxAtStartFootnote%\begin{enumerate}
\setcounter{enumi}{19}
\item {} 
...
\end{enumerate}

That % without a newline is a problem

@tk0miya
Copy link
Member

tk0miya commented Jun 9, 2016

@jnothman Thank you for reporting.
stable branch has same error. so I fixed it on stable.
It will be merged master later.

@jnothman
Copy link
Contributor

jnothman commented Jun 9, 2016

Thanks for the fast fix!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 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

3 participants