4

I'm trying to get in gb4e glosses the first line to be in bold roman font but I can only set roman or bold, not both. How can I set both?

The document is a beamer presentation with a sans serif font as default font. I tried these, but they don't work:

\let\eachwordone=\textbf{\rmfamily}

and

\let\eachwordone=\rmfamily\bf

What I get is just \bf with the first code and just roman with the second.

1 Answer 1

7

The two letter font commands are deprecated, and have been replaced. Your second attempt was on the right track but you needed to use \bfseries instead of \bf. But also the syntax of TeX \let only allows a single token after the =; to do what you want you should use the LaTeX \renewcommand instead.

Furthermore, if you want to change the font of the translation line also, you will need to use a different method, since gb4e provides no built-in hook for that. In the example below I've used the \pretocmd from the etoolbox package to modify the \glt macro (whose synonym is \trans).

\documentclass{beamer}
\usepackage{gb4e}
\usepackage{etoolbox}
\renewcommand{\eachwordone}{\rmfamily\bfseries}
\pretocmd{\glt}{\rmfamily}{}{}
\begin{document}
\begin{frame}
\begin{exe}
\ex{
\gll This is the first line\\
     This is the second line\\
\glt This is the translation
}
\label{ex}
\end{exe}
\end{frame}
\end{document}

output of code

Personally, however, I would not mix serif and sans serif fonts in a beamer presentation, so a simpler way would be just to use \usefonttheme{serif} and then define just \eachwordone to be \bfseries:

\documentclass{beamer}
\usefonttheme{serif}
\usepackage{gb4e}
\renewcommand{\eachwordone}{\bfseries}
\begin{document}
\begin{frame}
\begin{exe}
\ex{
\gll This is the first line\\
     This is the second line\\
\glt This is the translation
}
\label{ex}
\end{exe}
\end{frame}
\end{document}

If you would prefer all the text to be in the sans serif font to match the default beamer fonts, you will need to change each of the macros that determine the font for the gloss lines. These are \eachwordone, \eachwordtwo and \eachwordthree. So to get all gloss lines in sans serif you add

\renewcommand{\eachwordone}{\sffamily}
\renewcommand{\eachwordtwo}{\sffamily}
\renewcommand{\eachwordthree}{\sffamily}
4
  • 1
    Thanks Alan! Luckily my presentation is just an introduction to XeLaTeX. I'm using DejaVu fonts but they don't have true small caps. That is why I'm mixing typefaces. Do you know a sans font with IPA support, italics, bold, and small caps?
    – Stefano
    Commented Jun 19, 2014 at 8:32
  • @Stefano Sans serif IPA fonts are quite rare; SIL Sophia was one, but it doesn't seem to be supported by SIL anymore. I think the IPA was designed with a serifed font in mind, and adaptations to sans serif faces are always weak.
    – Alan Munn
    Commented Jun 19, 2014 at 15:08
  • For me, gb4e mixes serif and sans serif fonts, so that I get the example and the gloss in a serif font, and the translation in a sans serif font. Instead of using \usefonttheme{serif}, I'd like my whole presentation to use the sans serif font. Is there a way to change gb4e to achieve this? Commented Jun 15, 2016 at 20:46
  • @SebastianSulger I've updated the answer to show you how to achieve uniform sans serif glosses.
    – Alan Munn
    Commented Jun 15, 2016 at 20:54

You must log in to answer this question.

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