From 8b10cfd91ee552df01b4b409b9980f25dc4b0cbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicholas=20Kr=C3=A4mer?= Date: Mon, 20 Nov 2023 14:31:07 +0100 Subject: [PATCH] Add the tex-requirement to the "FAQ" section in the documentation (#126) * Add tex-requirement to troubleshooting * Mention google colab --- .../source/getting_started/troubleshooting.md | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/docs/source/getting_started/troubleshooting.md b/docs/source/getting_started/troubleshooting.md index 8d98f1c..e4d2f86 100644 --- a/docs/source/getting_started/troubleshooting.md +++ b/docs/source/getting_started/troubleshooting.md @@ -1,13 +1,20 @@ -# Troubleshooting +# FAQ: Frequently asked questions ## My version of matplotlib cannot find font XYZ?! -Some of the fonts that `tueplot` provides (e.g., `Times` or `Roboto`) needs to be installed on your machine before matplotlib can find it. -This means that you need to find a `.ttf` file online (e.g., `Roboto` family is available at Google fonts: https://fonts.google.com/specimen/Roboto), +Some fonts that `tueplot` provides (e.g., `Times` or `Roboto`) must be installed on your machine before matplotlib can find them. +This means that you need to find a `.ttf` file online (e.g., the `Roboto` family is available at Google fonts: [link-to-roboto](https://fonts.google.com/specimen/Roboto), download it, and install it. For Ubuntu, this means opening the file (with your font manager) and clicking `install`. There are probably many other ways to do this. Once the font is installed, delete your matplotlib cache (usually: `rm ~/.cache/matplotlib -rf`) and restart your notebook (not just the kernel). -See also https://stackoverflow.com/questions/42097053/matplotlib-cannot-find-basic-fonts/42841531. +See also [this question on Stack Overflow](https://stackoverflow.com/questions/42097053/matplotlib-cannot-find-basic-fonts/42841531). + +On a related note: if you want to use the Latex version of the fonts/bundles, your system must include the required tex packages. +See [this Stack Overflow discussion](https://stackoverflow.com/questions/55746749/latex-equations-do-not-render-in-google-colaboratory-when-using-matplotlib) +for information. +You may encounter this problem when using Tueplots in combination with a Google Colab notebook. + + ## My fonts are not displayed as expected with `plt.rc_context()` @@ -16,33 +23,31 @@ If someone knows why, please let us know. :) ## I am still getting 'overfull hbox' errors in my latex code -Even though the figsizes delivered by tueplots match the figure sizes in style files exactly, -sometimes, figures can be a few pt wider than what latex allows. +Even though the figure sizes delivered by Tueplots match the figure sizes in style files exactly, sometimes, figures can be a few points wider than what latex allows. Visually, this does not make any difference, -but it might lead to 'overfull hbox' raised by, e.g., 'pdflatex'. -This is not tueplots fault, but likely due to the optimisation that matplotlib carries out +but it might lead to an 'overfull hbox' raised by, e.g., 'pdflatex'. +This is not Tueplots' fault but likely due to the optimisation that matplotlib carries out as part of constrained_layout=True or tight_layout=True. Refer to the constrained layout documentation for more info. **Solution:** If you really cannot live with this warning, there are the following possible solutions: -* Instead of `\includegraphics()`, use `\includegraphics[width=\textwidth]()` -(to fix the final few pt -- the visual difference is zero). +* Instead of `\includegraphics()`, use `\includegraphics[width=\textwidth]()`. This fixes the final few pixels, and the visual difference is non-existent. * Set the `rel_width` in the figsizes to, e.g., `rel_width=0.97` and use `\includegraphics()` as usual. ## My submission template requires Type 1 fonts -Type 1 fonts are a tricky requirements; for example, because +Type 1 fonts are a tricky requirement; for example, because Adobe will disable support for authoring with Type 1 fonts in January 2023 . -Matplotlib cannot do Type 1 fonts, but uses Type 3 fonts as a default. +Matplotlib cannot do Type 1 fonts but uses Type 3 as a default. There is also no way of making matplotlib use Type 1 fonts. -The only options are Type 3 fonts and Type 42 (/TrueType) fonts. +The only options are Type 3 and Type 42 (/TrueType) fonts. **Solution:** -If you _need_ Type 1 fonts, using TeX typesetting usually does the trick: E.g., via `bundles.icml2022(usetex=True)`, +If you _need_ a Type 1 font, using TeX typesetting usually does the trick: E.g., via `bundles.icml2022(usetex=True)`, or `fonts.icml2022_tex()`. If the goal, however, is only to avoid type 3 fonts, adding -`plt.rcParams.update({"pdf.fonttype": 42})` to your plotting code will a PDF with `TrueType` fonts. +`plt.rcParams.update({"pdf.fonttype": 42})` to your plotting code will create a PDF with `TrueType` fonts. See this issue for more details.