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

[LaTexWriter] Better spacing between section number and title #1785

Merged
merged 3 commits into from
Apr 5, 2022

Conversation

ViralBShah
Copy link
Contributor

No description provided.

@ViralBShah ViralBShah changed the title Set TOC depth to chapter level Set TOC depth to chapter level for LaTeX (and hence pdf docs) Apr 3, 2022
@ViralBShah ViralBShah changed the title Set TOC depth to chapter level for LaTeX (and hence pdf docs) [LaTexWriter] Set TOC depth to chapter level for LaTeX (and hence pdf docs) Apr 3, 2022
@mortenpi mortenpi added Type: Enhancement Format: LaTeX Related to the LaTeX / PDF output labels Apr 4, 2022
@mortenpi
Copy link
Member

mortenpi commented Apr 4, 2022

If I am not mistaken, this would remove the section links everywhere. I don't generally use the PDF documentation, but I feel that if I did, I would find it helpful to be able to jump to the right section? Each .md page of the manual is quite long.

Screenshot from 2022-04-04 13-21-01

@ViralBShah
Copy link
Contributor Author

I guess that can be useful to have since the manual is so large. Maybe we just need to improve the spacing for sections in the manual.

@inkydragon Would you know how to do that?

@inkydragon
Copy link

improve the spacing for sections in the manual.

% indent before section number
\\setlength{\\cftsectionindent}{2.5em \\@plus \\p@}

Maybe inc 2.5em


But these style adjustments are julia manual related, not universal, right?

It seems like I need to update this pr JuliaLang/julia#43698.

@ViralBShah
Copy link
Contributor Author

ViralBShah commented Apr 4, 2022

I think Julia manual is the biggest user of generating pdf docs. Also a bit of extra spacing will not hurt other projects -so I think we should just do it universally. And we should revert my change to TOC depth here- and increase spacing for sections.

@ViralBShah
Copy link
Contributor Author

Mainly need to fix these two (which should be fixed in Documenter.jl):

Screen Shot 2022-04-04 at 12 17 34 PM

Screen Shot 2022-04-04 at 12 17 54 PM

@ViralBShah
Copy link
Contributor Author

Do we not need something like this to increase the spacing between the section number and section title?

\setlength{\cftsectionnumwidth}{2.5em \@plus \p@}

@inkydragon
Copy link

inkydragon commented Apr 5, 2022

Do we not need something like this to increase the spacing between the section number and section title?

Yes, and \setlength{\cftsectionnumwidth}{3.0em \@plus \p@} look good.

image

—— Figure 9.2, memman


With:

\setlength{\cftsectionnumwidth}{3.0em \@plus \p@}

Left: julia#master(dacf9d6) + Documenter.jl#v0.27.15 VS Right with patch
image


PDF building Tips:

  • Use Documenter.LaTeX(platform = "none") in make.jl then you got all *.tex files.
  • Modify documenter.sty:
% listings
-\usepackage{listings, minted}
+\usepackage{listings}
+\usepackage[draft=true]{minted}

This turns off the highlighting of the code and can greatly speed up the compilation process.

  • Compile all *.tex by youself. I recommend using tectonic.

@ViralBShah
Copy link
Contributor Author

ViralBShah commented Apr 5, 2022

Thanks to your really nice comments in the code, I had indeed found that diagram, which is the most useful documentation!

@inkydragon Does this PR look good? I am using 4.0em to give it a bit more spacing.

@ViralBShah ViralBShah changed the title [LaTexWriter] Set TOC depth to chapter level for LaTeX (and hence pdf docs) [LaTexWriter] Better spacing between section number and title Apr 5, 2022
@ViralBShah
Copy link
Contributor Author

It would be nice to add the PDF building tips to Documenter's docs.

@inkydragon
Copy link

4.0em VSVS 3.0em

image

Does this PR look good?

LGTM.

It would be nice to add the PDF building tips to Documenter's docs.

Yes, however, it looks like only julia's manual is slow to compile, so perhaps the PDF building tips should be added to julia's project documentation.

Documenter.jl might need to include a test that has multiple levels of chapters & sections, like julia's manual.

@ViralBShah
Copy link
Contributor Author

I installed tectonic with homebrew. It doesn't seem to have latex and such commands. Howevever, I have been hearing that people are rapidly adopting tectonic, and we may want to do that ourselves eventually. I had to use the docker method to build the pdf in julia base.

@inkydragon
Copy link

It doesn't seem to have latex and such commands.

tectonic -X compile --keep-logs -Z shell-escape  TheJuliaLanguage.tex

And if you want code highlighting, you need install minted: installing - How to install minted in Ubuntu - TeX - LaTeX Stack Exchange

minted needs to call an external program pygments which is a python pkg.

@ViralBShah
Copy link
Contributor Author

With the tectonic command, I get:

error: ./documenter.sty:4: Package fontspec Error: The font "DejaVu Sans" cannot be found.

For immediate help type H <return>
Writing `TheJuliaLanguage.log` (12.21 KiB)

@ViralBShah ViralBShah merged commit cd49b07 into master Apr 5, 2022
@ViralBShah ViralBShah deleted the vs/toc branch April 5, 2022 14:28
@ViralBShah
Copy link
Contributor Author

@mortenpi @fredrikekre Can I go ahead and tag a new release to get these pdf improvements into julia?

@inkydragon
Copy link

The font "DejaVu Sans" cannot be found.

Missing fonts

  • DejaVuSans.ttf
  • DejaVuSansMono.ttf

Install dejavu-fonts on macOS with MacPorts

@ViralBShah
Copy link
Contributor Author

Appreciate it. Now:

error: _minted-TheJuliaLanguage/681C970CC716FB99FA936E8A6E371DE25218153D23BFA92BF6039169C02165FC.pygtex:2: Undefined control sequence
Writing `TheJuliaLanguage.log` (58.65 KiB)
error: halted on potentially-recoverable error as specified

I have pygments installed.

@inkydragon
Copy link

Deleting temporary files and folder _minted-*, then try again.

pdftex - Minted not working - TeX - LaTeX Stack Exchange

@ViralBShah
Copy link
Contributor Author

Thank you - that worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: LaTeX Related to the LaTeX / PDF output Type: Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants