useblocks / sphinx-needs

Adds needs/requirements to sphinx
https://sphinx-needs.readthedocs.io/en/latest/index.html
MIT License
211 stars 66 forks source link

Latex output (PDF) no margins around need content #278

Open mihnen opened 3 years ago

mihnen commented 3 years ago

When I generate a pdf build there are large borders around the title and tags but the actual need content has no margins and looks terrible. This is the main content item that readers need to see... can this be fixed?

2021-05-27 10_22_13 - Adobe Acrobat Reader DC (32-bit)

danwos commented 3 years ago

I'm not a Latex/Pdf expert and sphinx-needs itself does not set any layout related information for these output formats. So the extension itself can not fix it.

But as far as I know Sphinx itself has some ways to controll the Latex/Pdf output. I have to make some research for this....

tim-nordell-nimbelink commented 1 year ago

@danwos This might be fixed with https://github.com/tim-nordell-nimbelink/sphinx-needs/tree/fix/extra_blanks_in_latex_needs. The nodes.line_block() context, for whatever reason, was causing a lot of extra vertical whitespace within the PDF output from LaTeX. I don't know if it breaks other things in the HTML side since I had to also drop one of the classes being emitted there for the LaTeX rendering to still work.

I'll note separately, that the built-in complete view is broken in the LaTeX rendering. I don't know how this patch impacts any HTML views other than "clean".

danwos commented 1 year ago

Thanks for the hint with nodes.line_block(). :+1:

I tried to create a PR from https://github.com/tim-nordell-nimbelink/sphinx-needs/tree/fix/extra_blanks_in_latex_needs, but it looks like it contains some other changes as well. Can you create a PR for it, so that our CI can run the tests and we see the impact on the HTML build quite easily?

tim-nordell-nimbelink commented 1 year ago

@danwos Sure, I'll create a PR. That branch listed just has one change on top of tag 1.1.0. (Master in my fork has the 3 sets of changes I've made merged together.)

I will warn you that a few additional built-in tests fail in the make test-short set with this change; I haven't investigated them, so it very likely breaks something else. I'll mark the PR as a draft. (The make test-short fails quite a few tests on my machine on tag 1.1.0; I'm assuming I just don't have something setup correctly in my build environment.)

tim-nordell-nimbelink commented 1 year ago

I guess I'll additionally note that I removed some of the nested <span> elements in the output that didn't have a new class in the output. That isn't technically required as a minimal fix for the LaTeX output. (The main thing for the LaTeX output was a class spanning multiple paragraphs, and to get rid of the nodes.line_block() context and related classes.)

(I just split this change out into its own commit and pushed it into the branch.)