jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

Font size does not change in PDF output

Open raptistasos opened this issue 3 years ago • 11 comments

Hi,

I am trying to change the font size of the PDF output (using the xelatex engine) via the sphinx: config: latex_elements: pointsize: value in the _confing.yml but no effect is observed. Do you have any idea about it?

The corresponding part in _confing.yml looks like this,

sphinx:
  config:
    latex_elements:
      papersize             : a4paper #(tried lettepaper as well)
      pointsize             : 12pt #(tried 10-16pt)
      fncychap              : \usepackage[Glenn]{fncychap}
      babel                 : "\\usepackage{polyglossia}\n\\setmainlanguage{greek}\n\\setotherlanguage{english}"
      fontpkg               : "\\setmainfont[Script=Greek]{GFS Artemisia} \n\\setsansfont[Script=Greek]{GFS Neohellenic}

Thanks!

> jupyter book --version
Jupyter Book      : 0.12.1
External ToC      : 0.2.3
MyST-Parser       : 0.15.2
MyST-NB           : 0.13.1
Sphinx Book Theme : 0.1.6
Jupyter-Cache     : 0.4.1
NbClient          : 0.5.3

raptistasos avatar Feb 17 '22 11:02 raptistasos

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Feb 17 '22 11:02 welcome[bot]

Thanks @raptistasos for bringing this up, I have similar issue including line spacing

krishpn avatar Feb 18 '22 13:02 krishpn

Hello, I had the same problem with pointsize and other class options. I solved these issues and proposed a fix in this PR https://github.com/executablebooks/sphinx-jupyterbook-latex/pull/92 last month, unfortunately it hasn't been reviewed so far. But you should be able to solve the issue with the updated jupyterBook.cls from the PR as a workaround or you can also use my jupyter-book setup from this repo https://github.com/florianbussmann/scientific-reports-with-jupyter

I hope the instructions from the PR are helpful, otherwise feel free to ask questions!

florianbussmann avatar Mar 11 '22 16:03 florianbussmann

thanks @raptistasos for opening this issue. Thanks @florianbussmann for the PR. I see @AakashGfude is now reviewing that.

mmcky avatar Apr 01 '22 02:04 mmcky

https://github.com/executablebooks/sphinx-jupyterbook-latex/pull/92 has been merged now. Thanks, @florianbussmann for the change. Will be available in the next sphinx-jupyterbook-latex release.

AakashGfude avatar Apr 04 '22 04:04 AakashGfude

After updating to sphinx-jupyterbook-latex==0.4.7 the pointsize setting from my _config.yml still does not have an effect on the resulting PDF.

Jupyter Book      : 0.13.1
External ToC      : 0.2.4 
MyST-Parser       : 0.15.2
MyST-NB           : 0.13.2
Sphinx Book Theme : 0.3.2 
Jupyter-Cache     : 0.4.3 
NbClient          : 0.5.13

The relevant parts of my configuration are:

_config.yml

sphinx:
  config:
    latex_elements: 
      papersize: "a4paper"
      pointsize: 18pt
latex:
  latex_engine: "xelatex"

_toc.yml

format: jb-book
root: index
chapters:
- file: 0_Prefix/index.md
- file: 1_Introduction/index.md

I don't have a custom jupyterBook.cls like @florianbussmann had, but just the jupyter-book default.

Do I need this custom jupyterBook.cls theme, or did I miss something else?

Related to font sizes, I'm still looking for a way to change the code-block fontsize (https://github.com/orgs/executablebooks/discussions/730).

michaelosthege avatar Oct 20 '22 15:10 michaelosthege

@AakashGfude @mmcky @chrisjsewell sorry to tag you, but I'm under time pressure and pretty much lost with debugging why pointsize has no effect on the generated PDF 😕

The pointsize setting (as shown above) ends up in the generated LaTeX in line 3 \documentclass[a4paper,18pt,english]{jupyterBook} but this has no effect on the resulting PDF.

I tried several ways to change the font size but none of them were successful. At this point I simply don't understand which package/setting determines the de-facto fontsize of the result.

If anybody could give me some pointers that would be great! I'll gladly contribute this information to the docs or submit a PR to bugfix something :)

michaelosthege avatar Oct 25 '22 14:10 michaelosthege

Hi @michaelosthege, by default latex does not support 18pt. Only 10pt, 11pt, 12pt from what I have seen. Also, mentioned in this comment https://github.com/executablebooks/sphinx-jupyterbook-latex/pull/92#issuecomment-1086989622 . There are some packages which can extend this range as given in https://texblog.org/2012/08/29/changing-the-font-size-in-latex/. Do you want higher ranges for your project?

AakashGfude avatar Oct 25 '22 23:10 AakashGfude

Thank you @AakashGfude!! Looks like I expected too much of LaTeX.. For my thesis I think 12pt will be good enough.

Next I'll try to reduce the size of code blocks (as we discussed a few months back).

michaelosthege avatar Oct 26 '22 09:10 michaelosthege

Hey Is there a way to adjust the font size of the title of the Jupyter book?

For example on https://m2lines.github.io/L96_demo/intro.html

I want the text Learning Machine Learning with Lorenz-9 on the navbar to be slightly bigger as there is a lot of text and want it to be significant enough to be seen as the title

IamShubhamGupto avatar Jun 01 '23 02:06 IamShubhamGupto

I'm trying to use the fontsize 12pt but am not seeing any change when generating the output PDF.

Is this still an open issue?

psychemedia avatar Aug 07 '23 14:08 psychemedia