0

How would I get the following example to work (that is, uncomment %\fontspec...? The thought process that has gone into it is in the remarks: first I was looking for a font that mimic's Twitter, then...

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{keyfloat}
\usepackage{tgheros}

% AucTeX users: Command > TeXing options > Use LuaLaTex engine 
% https://tug.org/FontCatalogue/texgyreheros/ % tgheros
% https://latex.org/forum/viewtopic.php?t=25799 % The font "Helvetica Neue" cannot be found
% https://www.quora.com/What-font-does-Twitter-use/answer/Alina-Sava

\renewcommand*\familydefault{\sfdefault}

\begin{document}

\keyfig[H]{lw=0.22,cstar={}}{sample-1.png}

\begin{center}\bfseries\large\#Algorithms\end{center}

%% Error: The font "GyreTexHeros" cannot be found.
%{\fontspec{Gyre Tex Heros}\#Algorithms}

\end{document}

sample-1

Display


PS:

/usr/local/texlive/2018 $ find . -name tex-gyre
./texmf-dist/tex/latex/tex-gyre
$ ls
texgyreadventor-bold.fea        texgyrepagella-bold.fea
texgyreadventor-bolditalic.fea  texgyrepagella-bolditalic.fea
texgyreadventor-bolditalic.sfd  texgyrepagella-bolditalic.sfd
texgyreadventor-bold.sfd        texgyrepagella-bold.sfd
texgyreadventor-italic.fea      texgyrepagella-italic.fea
texgyreadventor-italic.sfd      texgyrepagella-italic.sfd
texgyreadventor-regular.fea     texgyrepagella-regular.fea
texgyreadventor-regular.sfd     texgyrepagella-regular.sfd

which does not contain 'Heros', so the question perhaps boils down to where how to install the complete TeX Gyre Heros package under Linux/Texlive?

  • 1
    Would something in the line of \raisebox{\depth}{\small\#} work for you or I misunderstood the question? – Rmano Oct 4 '19 at 5:37
  • It could be useful as workaround. I have restated the question. – Erwann Oct 4 '19 at 19:15
2

You want to load either fontspec and a Unicode font, or the legacy 8-bit font packages, but not both. Therefore, you should not load fontenc or tgheros if you also load fonspec.

Instead, you would want a preamble like

\documentclass{report}
\usepackage{fontspec}
% Other packages.

\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{TeX Gyre Heros}[Scale = 1.0]

Since you appear to be using Linux, you should be able to install TeX Gyre Heros through your package manager.

Note that, on Windows, Twitter’s style sheet looks for Segoe UI, then Arial, then the default sans-serif font. On Mac, for Helvetica Neue, then Helvetica, then Arial, then the default sans-serif. If you have the fonts available (say, by putting a symlink to the font file on your Windows partition in ~/.fonts or /usr/local/share/fonts) you can use the exact same font as Twitter—on some browsers.

PS

In response to your follow-up question, you could make Heros available but not the main font with

\newfontfamily\qhv{TeX Gyre Heros}[Ligatures={Common, TeX}]

TeX Gyre Heros is font family qhv in the legacy 8-bit font system, and the \qhv command is backward-compatible with the tgheros package.

|improve this answer|||||
  • Which of the three? $ apt-cache search tex-gyre fonts-texgyre - OpenType fonts based on URW Fonts tex-gyre - scalable PostScript and OpenType fonts based on URW Fonts texlive-fonts-extra - TeX Live: Additional fonts – Erwann Oct 4 '19 at 20:15
  • I don't want it as the main font, just in some places. I guess I will have to compile separately and use \include. – Erwann Oct 4 '19 at 20:18
  • The answer to my first comment is $ sudo apt-get install tex-gyre, and the similarity with Twitter is good. The problem that remains is that I don't want TGH as the default, only locally. How would I do that? – Erwann Oct 4 '19 at 20:32
  • Answer: \newfontface\tgh{Tex Gyre Heros}%[⟨font features⟩] {\tgh\selectfont \#Algorithms} – Erwann Oct 4 '19 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.