3

How can I use these fonts on Overleaf with plain TeX?

\font\tenpalatino=Palatino at 10pt
\font\bighelvetica=Helvetica at 30pt

This is a test. \tenpalatino This is Palatino font at 10pt. \par
\bighelvetica This is Helvetica font at 30pt. 

\bye

enter image description here

9
  • 3
    Use standard names like, Roman pplr8t, italic pplri8t, bold pplb8t and bold-italic pplbi8t and smallcaps pplbc8t for font names, e.g., \font\tenpalatino=pplr8t at 10pt
    – MadyYuvi
    Dec 30, 2022 at 4:51
  • Which engine are you trying to run? You must give PDFTeX a tfm (TeX font metrics) file to set it up; and as the other comment implies, most PostScript font metrics files have peculiar filenames documented in Karl Berry's paper
    – jarnosz
    Dec 30, 2022 at 19:49
  • @jarnosz I'm using Overleaf with LaTeX engine to run plain TeX. Just a beginer and want to learn LaTeX begining from TeX.
    – emnha
    Dec 31, 2022 at 5:05
  • The code above is from a book I'm reading but it doesn't compile so I made this question.
    – emnha
    Dec 31, 2022 at 5:16
  • what's that book's title, if you don't mind?
    – jarnosz
    Dec 31, 2022 at 7:16

3 Answers 3

3

Assuming that you want some of the Standard Postscript fonts, beware that you must give the [PDF]TeX engine a tfm (TeX font metrics) file to set it up; and as stated in the comments to your question, most PostScript font metrics files have peculiar filenames documented in Karl Berry's paper on TUGBoat 11-1990 and the reference guide on the tug website. Given that info, the following should work in any engine, provided you have followed the instructions given in Overleaf to set up a custom TeX engine in your latexmkrc file.

\font\tenpalatino=pplr8y at 10pt
\font\bighelvetica=phvr8y at 30pt

This is a test. \tenpalatino This is Palatino font at 10pt. \par
\bighelvetica This is Helvetica font at 30pt. 

\bye

That convention is already present in Example 7, Section 3 of TeX for the Impatient.

sample postscript fonts on pdftex

2

Use luahbtex and file names:

\input luaotfload.sty
\font\tenpalatino="file:texgyrepagella-regular.otf" at 10pt
\font\bighelvetica="file:texgyreheros-regular.otf" at 30pt

This is a test. \tenpalatino This is Palatino font at 10pt. \par
\bighelvetica This is Helvetica font at 30pt. 

\bye

enter image description here

7
  • This suggestion may work, if you are a "LaTeX fundamentalist", who does not mind throwing L3 code into a Plain solution.
    – jarnosz
    Dec 31, 2022 at 7:23
  • 1
    luaotfload simplifies the loading of OpenType fonts. That's all. It has nothing to do with LaTeX
    – user187802
    Dec 31, 2022 at 8:16
  • actually, it does: luaofload.sty has a call to ltluatex.tex, which is part of the LaTeX kernel, to do the rest of the stuff, if you check the luaotfload and latex repositories, and this discussion.
    – jarnosz
    Dec 31, 2022 at 8:36
  • 1
    "Part of the LaTeX kernel" doesn't mean that it is pure LaTeX code...
    – user187802
    Dec 31, 2022 at 8:43
  • 1
    @jarnosz OK, luaotfload has something to do with LaTeX. But its great part of the code is borrowed from fontloader from ConTeXt. So, we can say that this has something to do with ConTeXt too. And, sure, it has nothing to do with L3 code.
    – wipet
    Jan 9 at 13:17
2

If you're not a plain TeX purist that even refuses to look in LaTeX files, you can see that palatino.sty has

\renewcommand{\rmdefault}{ppl}
\renewcommand{\sfdefault}{phv}
\renewcommand{\ttdefault}{pcr}

The default output encoding of LaTeX reflects the plain TeX setup for fonts, so you want to look at ot1ppl.fd

\DeclareFontShape{OT1}{ppl}{m}{n}{<-> pplr7t}{}
\DeclareFontShape{OT1}{ppl}{m}{sc}{<-> pplrc7t}{}
\DeclareFontShape{OT1}{ppl}{m}{sl}{<-> pplro7t}{}
\DeclareFontShape{OT1}{ppl}{m}{it}{<-> pplri7t}{}
\DeclareFontShape{OT1}{ppl}{b}{n}{<-> pplb7t}{}
\DeclareFontShape{OT1}{ppl}{b}{sc}{<-> pplbc7t}{}
\DeclareFontShape{OT1}{ppl}{b}{sl}{<-> pplbo7t}{}
\DeclareFontShape{OT1}{ppl}{b}{it}{<-> pplbi7t}{}

(slightly edited for compactness). You therefore want

\font\tenpalatino=pplr7t at 10pt

because this correspond to medium weight (m) and normal (n) shape. The standard design size for PostScript fonts is 10pt, so you may even omit at 10pt.

Similarly, looking in ot1phv shows that the declaration you need is

\font\bighelvetica=phvr7t at 30pt

Full example, also showing accents.

\font\tenpalatino=pplr7t at 10pt
\font\bighelvetica=phvr7t at 30pt

This is a t\^est. \tenpalatino This is Palatino f\'ont at 10pt. \par
\bighelvetica This is Helvetica f\"o\~nt at 30pt. 

\bye

enter image description here

Beware that these fonts don't contain Greek letters, so you need to define them separately if you want to use them in math.

3
  • @jarnosz A class of people that I think doesn’t exist.
    – egreg
    Dec 31, 2022 at 9:03
  • 1
    @jarnosz So, where's the rudeness? My dictionary says “a person who adheres strictly to the basic principles of any subject or discipline”.
    – egreg
    Dec 31, 2022 at 9:16
  • 1
    @jarnosz I don't think that applies, but I changed the wording nonetheless.
    – egreg
    Dec 31, 2022 at 17:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .