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

Add support for Sphinx latexpdf output #3650

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TunaLobster
Copy link
Contributor

@TunaLobster TunaLobster commented Jul 16, 2021

Currently I am a little stuck on the pdflatex portion of this. I hit a fatal error when getting to the jpeg for the Mamba F405. Maybe someone with a more knowledge of pdflatex can help with that. I also get a slew of warnings from the inputenc package about Unicode characters.

To get to this point, I had to remove the sphinxcontrib.vimeo module since the sphinxcontrib.youtube module supports Vimeo in latex output. I have not checked what that looks like for the html. I also added a few options to the update.py file.

!pdfTeX error: pdflatex (file ./mamba_f405mk2_board.jpg): reading JPEG image fa
iled (no JPEG header found)
 ==> Fatal error occurred, no output PDF file produced!
Latexmk: Index file 'ArduPilot.idx' was written
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.
Makefile:29: recipe for target 'ArduPilot.pdf' failed
make[1]: *** [ArduPilot.pdf] Error 12

@TunaLobster
Copy link
Contributor Author

Fixed the issue with the Mamba405 image format. Got all the way to a loop with a \cr command.

! Missing \cr inserted.
<inserted text> 
                \cr 
l.52728 \end{longtable}
                       \sphinxatlongtableend\end{savenotes}
! Misplaced \cr.
<inserted text> \cr 
                    
l.52728 \end{longtable}
                       \sphinxatlongtableend\end{savenotes}
(That makes 100 errors; please try again.)
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on ArduPilot.log.
Latexmk: Index file 'ArduPilot.idx' was written
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.
Makefile:29: recipe for target 'ArduPilot.pdf' failed
make[1]: *** [ArduPilot.pdf] Error 12
make[1]: Leaving directory '/home/charlie/ardupilot_wiki/plane/build/latex'
Makefile:136: recipe for target 'latexpdf' failed
make: *** [latexpdf] Error 2

I also forgot to do this initially:
Fixes #3407

@TunaLobster
Copy link
Contributor Author

This is now functional for Plane. There are probably more jpg files in RIFF format that will cause issues. Working on my bash skills for find all of those. Parameters are currently not included due to the carriage return loop issue. I hope to be able to chase that down at some point. 1700+ pages for just Plane without parameters. Table of contents is blank too. I'm not too worried about that. Using Control-F in Adobe isn't terrible.

Build command is python3 update.py --site plane --no-html --latexpdf --paramversioning
Parameter versioning option is used to skip building the parameters. Just dodging those issues for now.

Force pushing to see if CI can be fixed.

@TunaLobster
Copy link
Contributor Author

Found the issue with the Parameters.rst. A working partial example can be seen over in this repo.

https://raw.githubusercontent.com/TunaLobster/TempBugTesting/master/source/Parameters.rst

The issue seems to be LaTeX support for nesting longtables. We could solve this by changing how we format the tables, but that would be a different PR. What I did to change the formatting manually would work and look nice for the Values-Value|Meaning tables, but not so great for the tables that have Reboot Required. I'm not sure why that's in a table instead of a note like the advanced user flag.

What is interesting is that not all of the "long tables" we have in the parameters cause the issue. Just some of them. The first one that causes issues is AHRS_ORIENTATION. I haven't dug into how sphinx LaTeX commands provide formatting, but it would seem that there is a breakover point between using longtables and multirow. I think it's multirow. Might be tabular.

@TunaLobster
Copy link
Contributor Author

This works for each wiki now except the dev wiki. That one is hitting the TeX word limit which means something is wrong with the TeX and not necessarily with our rst. So there is something more wrong there that needs some deeper digging.

@TunaLobster TunaLobster marked this pull request as ready for review September 1, 2021 15:26
@TunaLobster
Copy link
Contributor Author

Dependent on #3735

@TunaLobster TunaLobster marked this pull request as draft September 8, 2021 23:22
@TunaLobster TunaLobster force-pushed the pr-latexpdf branch 2 times, most recently from 75b92ab to f3d08fd Compare March 10, 2022 19:59
@TunaLobster TunaLobster marked this pull request as ready for review March 10, 2022 22:21
@TunaLobster
Copy link
Contributor Author

This is functional now. Had a small issue with the Dev wiki that was solved by changing the engine to xelatex rather than pdflatex. I don't have a preference on the engine. pdflatex is the sphinx default.

Dependent on #4195 (delay merge until that one goes in)

@khancyr
Copy link
Contributor

khancyr commented Mar 10, 2022

Did you try with my theme update PR ? It should probably help... I need to sync with Henry to get it in

@TunaLobster
Copy link
Contributor Author

No noticeable differences in the pdfs after changing the theme. Still builds though. I think what I was commenting on in the theme PR were things I was noticing from working with the Parameters.rst generators.

I don't thing we will be able to hold the pdfs in artifacts due to them being just under a GB in total size. I've already shortened the command line logs to keep that part of CI happy if we eventually want to run CI for latex.

@TunaLobster
Copy link
Contributor Author

Ready for review on this one!

@TunaLobster
Copy link
Contributor Author

Rebased to get the update.py changes. Added Blimp and got a Table of Contents working on some of the docs. Plane and a few others. Not copter for some reason. Also caught a few build warnings and fixed them.

@TunaLobster
Copy link
Contributor Author

Added the pdf build to CI. Currently failing due to the copter issue. There's also a similar issue that I have solved before with tables inside tables for the logmessages.rst files. I fixed that for the parameter reST generator. That will need some extra digging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants