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

Bug: section titles are not bold if mathpazo package is used #1097

Closed
cgahr opened this issue Sep 26, 2023 · 7 comments
Closed

Bug: section titles are not bold if mathpazo package is used #1097

cgahr opened this issue Sep 26, 2023 · 7 comments

Comments

@cgahr
Copy link

cgahr commented Sep 26, 2023

mathpazo "unbolds" section headings

If I import the latex package mathpazo, section titles are suddenly not bold anymore. Compiling using pdflatex works as intendend:

with mathpazo

Code

\documentclass{article}
\usepackage{mathpazo}

\begin{document}
\section{Introduction}
\label{sec1}

\section{Preparation of Manuscript}
\label{sec2}
\end{document}

Screenshot of result

grafik

without mathpazo

Code

\documentclass{article}
% \usepackage{mathpazo}

\begin{document}
\section{Introduction}
\label{sec1}

\section{Preparation of Manuscript}
\label{sec2}
\end{document}

Screenshot of result

grafik

Version

tectonic --version
Tectonic 0.14.1
@Neved4
Copy link

Neved4 commented Sep 28, 2023

Hey @cgahr thx for this one!

If you try several engines you can see that only pdftex produces the desired output:

  • latexmk -pdf test.tex
  • latexmk -pdflua test.tex
  • latexmk -pdfxe test.tex
  • tectonic test.tex

While tectonic also strives to have reasonable compatibility with pdftex, this looks like something that will benefit from an upstream fix to make mathpazo support all engines.

@cgahr
Copy link
Author

cgahr commented Oct 9, 2023

Hmm, that's interesting.

It seems like mathpazo is really only supposed to work with pdflatex (see https://tex.stackexchange.com/questions/506765/xelatex-and-mathpazo-font).

Also, with the package being from the 2000s, I don't think that there will be any change to this (In addition, I did not find a way to contact the author).

I'd love to have it in tectonic anyway, but I perfectly understand the reason why this does not belong here. Please close the issue if there won't be any changes to tectonic to handle this.

@Neved4
Copy link

Neved4 commented Oct 23, 2023

@cgahr Their contact info is Diego Puga <d.puga@utoronto.ca>.

As an alternative, here's some code that works portably for pdfTeX / XeTeX / tectonic / LuaTeX, as long as you have Palatino installed in your system:

\documentclass{article}

\usepackage{iftex}
  \iftutex
    \usepackage{fontspec}
      \setmainfont{Palatino}
  \else
    \usepackage{mathpazo}
  \fi

\begin{document}
  Hello, World!
\end{document}

Cheers!

@vlasakm
Copy link
Contributor

vlasakm commented Oct 23, 2023

@cgahr The package mathpazo is intended for old 8-bit TeX (such as pdflatex). However, Tectonic is essentially a wrapper of xelatex (a modern Unicode based TeX). Providing full compatibility with the "old ways" in Tectonic is not straightforward.

If you are however willing to conditionally compile your document, based on what TeX engine is used, just like @Neved4 suggested, you may find luck with the following in your document's preamble:

\usepackage{iftex}
\iftutex
  % running under Unicode TeX engine (XeTeX, LuaTeX), use modern things
  \setmainfont{texgyrepagella}[
        Extension      = .otf,
        UprightFont    = *-regular,
        BoldFont       = *-bold,
        ItalicFont     = *-italic,
        BoldItalicFont = *-bolditalic]
  \usepackage{unicode-math}
  \setmathfont{texgyrepagella-math.otf}
\else
  % running something older, ensure it is pdfTeX (i.e `pdflatex` or `latex`)
  \RequirePDFTeX
  % additionally, force `latex` to produce PDF output (needed for Arxiv)
  \pdfoutput=1
  % use old things
  \usepackage{mathpazo}
\fi

Above, mathpazo is used for pdflatex, and TeX Gyre Pagella (a freely available descendant from the TeX community) is used for lualatex and xelatex (including Tectonic). Some of the TeX Gyre fonts, including Pagella (Palatino) also feature a unicode math font, which is also used by the example. There may be some differences, especially in some math details (as authors of these packages make different choices), but ultimately you should get a similar Palatino feel.

For future reference, the full example below works for me with Tectonic (although I am unable to test pdflatex now, I believe it should work just as well):

\documentclass{article}

\usepackage{iftex}
\iftutex
  % running under Unicode TeX engine (XeTeX, LuaTeX), use modern things
  \usepackage{fontspec}
  \setmainfont{texgyrepagella}[
        Extension      = .otf,
        UprightFont    = *-regular,
        BoldFont       = *-bold,
        ItalicFont     = *-italic,
        BoldItalicFont = *-bolditalic]
  \usepackage{unicode-math}
  \setmathfont{texgyrepagella-math.otf}
\else
  % running something older, ensure it is pdfTeX (i.e `pdflatex` or `latex`)
  \RequirePDFTeX
  % additionally, force `latex` to produce PDF output (needed for Arxiv)
  \pdfoutput=1
  % use old things
  \usepackage{mathpazo}
\fi

\begin{document}
\section{Introduction}
\label{sec1}

\section{Preparation of Manuscript}
\label{sec2}
\end{document}

If you are interested more about modern Unicode setups in TeX, be sure to read more in the documentation of the fontspec and unicode-math packages. I would recommend using the new ways even in case you end up not using Tectonic. But I also understand if you prefer classic approaches, and you don't see a need to switch.

The code above is based on comment elsewhere: #969 (comment). As mentioned in that issue, a shorter way of specifying the Pagella font is normally available:

  \setmainfont{TeX Gyre Pagella}
  \setmathfont{TeX Gyre Pagella Math}

However, that one suffers from another Tectonic issue (#9) and I actually think that specifying fonts by font file names rather than font names is much preferable and consistent (see #965 (comment))

@vlasakm
Copy link
Contributor

vlasakm commented Oct 23, 2023

@Neved4

\usepackage{iftex}
\ifpdftex \usepackage{mathpazo} \fi
\ifxetex \usepackage{fontspec} \setmainfont{Palatino} \fi
\ifluatex \usepackage{fontspec} \setmainfont{Palatino} \fi

I suggest \iftutex for code such as Unicode font setups, which is common for both xetex and luatex.

@Neved4
Copy link

Neved4 commented Oct 24, 2023

@vlasakm Great suggestion! 🚀 Edited to reflect it accordingly.

@cgahr
Copy link
Author

cgahr commented Oct 24, 2023

Thank you so much for your inputs! For now, I just try to not use mathpazo.

However, should the need arise, I know where to look!

@cgahr cgahr closed this as completed Oct 24, 2023
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

No branches or pull requests

3 participants