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

Reference not rendered correctly in sphinx 2.2.0 #6705

Closed
alex4200 opened this issue Sep 24, 2019 · 5 comments
Closed

Reference not rendered correctly in sphinx 2.2.0 #6705

alex4200 opened this issue Sep 24, 2019 · 5 comments

Comments

@alex4200
Copy link

Describe the bug

References are not rendered correctly in the references section. See the screenshot below.

To Reproduce
Content of the file source/index.rst:

=============
 Example
=============


Text
=====================

There is some reference [Heil2018]_ and some more [Stefan2014]_ and even more [Sterratt2015]_.
Repeating the last reference [Sterratt2015]_.

References
==========

.. [Heil2018] Reference1
.. [Stefan2014] Reference2            
.. [Sterratt2015] Reference3

compiled with

sphinx-build -M html source build

Expected behavior

I expected to see the text Sterratt2015 in blue above the phrase 'Reference3' like the other two references. Instead, you see only the indices '1' and '2', but no indication of the actual reference.

Screenshots

Selection_808

Environment info

  • OS: Ubuntu 16.04.6
  • Python version: 3.6.8
  • Sphinx version: 2.2.0
  • Sphinx extensions:
  • Extra tools:
@jfbu
Copy link
Contributor

jfbu commented Sep 24, 2019

Which html theme are you using? Is there any Sphinx extension involved? Any kind of CSS customization?

I do not reproduce the problem with either alabaster or classic. I also tried RTD theme.

Capture d’écran 2019-09-24 à 12 50 14

However the output does show some strange problem with lack of space in output, as we see comparing with 1.8.5 output:

Capture d’écran 2019-09-24 à 12 50 50

Strange nobody reported this so far (I will check later if this is existing issue; it might also depend on my Firefox settings regarding fonts).

@alex4200
Copy link
Author

Yes I see - with the alabaster theme it works as I expected.

I am not an expert with sphinx, but it seems to come down to some internal theme we are using. Also no sphinx extension involved (as far as I can see from the conf.py file).

I will check with that internal theme...

@jfbu
Copy link
Contributor

jfbu commented Sep 24, 2019

With Sphinx 1.8.5 I see each reference uses a <table> tag like this

<table class="docutils citation" frame="void" id="heil2018" rules="none">

but with 2.0 or later one sees a global <dl class="citation"> etc...

@jfbu
Copy link
Contributor

jfbu commented Sep 24, 2019

Regarding the lack of space, it is simply an insufficient CSS. For example Alabaster contains only

dl dd {
    margin-left: 30px;
}

and basic.css seems not having either special configuration.

Thus I "fixed" it using a _static/css/custom.css file like this:

dl.citation > dd {
    margin-left: 150px;
}

and I added to conf.py

html_static_path = ['_static']
html_css_files = [
    'css/custom.css',
]

here is out it comes out with Alabaster then

Capture d’écran 2019-09-24 à 14 06 34

In such circumstances the latexpdf has some means to compute an automatic label width, one wonders if something to this effect should be added to html.

Anyway, this still does not address your original issue, which as you reported might be related to some custom theme.

The important point is that probably existing themes do not style enough the References section since Sphinx 2.0 release which has modified the HTML tags used. New mark-up seems much better but it may require additional CSS styling be added to the themes.

Perhaps basic.css should get enhanced for some reasonable default. Ping @tk0miya if you have idea about this?

@tk0miya
Copy link
Member

tk0miya commented Sep 28, 2019

As described by @jfbu, Sphinx moves to HTML5 by default. And it uses <dl> tag for citations. As a workaround, you can switch old behavior via html4_writer = True in your conf.py. Then you'll see <table> tag based citation list.
Thanks,

@tk0miya tk0miya closed this as completed Nov 17, 2019
st-bender added a commit to st-bender/sciapy that referenced this issue Nov 20, 2019
The design/element change for footnotes made them look ugly and they did
not render correctly on RTD. Using the "old" writer should fix this
until a better solution comes up.

Ref: sphinx-doc/sphinx#6705

[skip ci]
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 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