garrettj403 / SciencePlots

Matplotlib styles for scientific plotting
MIT License
7.12k stars 709 forks source link

pound sign '#' issue with Tex #49

Closed sblanz closed 3 years ago

sblanz commented 3 years ago

Had some problems when I put a '#' in my subplot title.

latex was not able to process the following string: b'HR Response Animal #2'

Here is the full report generated by latex: This is pdfTeX, Version 3.141592653-2.6-1.40.23 (MiKTeX 21.8) entering extended mode (C:/Users/steph/.matplotlib/tex.cache/c6461476dd8de54b1e07f6b0e45f144a.tex LaTeX2e <2021-06-01> patch level 1 L3 programming layer <2021-08-27> (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls Document Class: article 2021/02/12 v1.4n Standard LaTeX document class (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/base\size10.clo)) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/type1cm\type1cm.sty) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/psnfss\helvet.sty (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/graphics\keyval.sty)) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/base\textcomp.sty) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/base\inputenc.sty) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsmath.sty For additional information on amsmath, use the `?' option. (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amstext.sty (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsgen.sty)) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsbsy.sty) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsopn.sty)) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amssymb.sty (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amsfonts.sty)) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/sfmath\sfmath.sty) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/geometry\geometry.sty (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/generic/iftex\ifvtex.sty (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/generic/iftex\iftex.sty)) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/geometry\geometry.cfg)

Package geometry Warning: Over-specification in h'-direction. width' (5058.9pt) is ignored.

Package geometry Warning: Over-specification in v'-direction. height' (5058.9pt) is ignored.

) (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-dvi ps.def) (c6461476dd8de54b1e07f6b0e45f144a.aux) geometry driver: auto-detecting geometry detected driver: dvips (C:\Users\steph\AppData\Local\Programs\MiKTeX\tex/latex/psnfss\ot1phv.fd) ! You can't use `macro parameter character #' in horizontal mode. l.14 ...{10.500000}{\sffamily HR Response Animal # 2} No pages of output. Transcript written on c6461476dd8de54b1e07f6b0e45f144a.log.

<Figure size 675x900 with 2 Axes>

garrettj403 commented 3 years ago

You need to escape special characters in Latex. Instead of "HR Response Animal #2", try "HR Response Animal \#2".

Alternatively, you can disable Latex by using the "no-latex" style.