Closed cgahr closed 8 months ago
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.
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.
@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!
@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: https://github.com/tectonic-typesetting/tectonic/issues/969#issuecomment-1310262516. 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 (https://github.com/tectonic-typesetting/tectonic/issues/9) and I actually think that specifying fonts by font file names rather than font names is much preferable and consistent (see https://github.com/tectonic-typesetting/tectonic/issues/965#issuecomment-1317865762)
@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.
@vlasakm Great suggestion! 🚀 Edited to reflect it accordingly.
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!
mathpazo
"unbolds" section headingsIf I import the latex package
mathpazo
, section titles are suddenly not bold anymore. Compiling using pdflatex works as intendend:with
mathpazo
Code
Screenshot of result
without
mathpazo
Code
Screenshot of result
Version