%!TeX lualatex
\documentclass[a4paper,14pt]{extbook} % to be able to print 14pt fonts
\pagenumbering{gobble}
\usepackage{fontspec}
\newfontfamily{\Termes}{TeXGyreTermes-Regular}
\newfontfamily{\TermesIt}{TeXGyreTermes-Italic}
\newfontfamily{\MyriadPro}{MyriadPro-Regular}
\newfontfamily{\MyriadProIt}{MyriadPro-It}
\usepackage{polyglossia}
\setdefaultlanguage{german}
\setotherlanguages{english}
\usepackage[svgnames]{xcolor}
\begin{document}
\textlang{german}
\MyriadPro
Präambel
Der Zweck dieser Lizenz ist es, ein Handbuch, Textbuch oder ein anderes
zweckdienliches und nützliches Dokument
\emph{frei} {\MyriadProIt frei} % I have to insert this to print "frei" italic
im Sinne von Freiheit, zu machen.
\bigskip
\textlang{english}
\Termes\small
% \textcolor{magenta}
% The line above causes Argument of \textcolor has an extra } error
% Consequently, I can't change the color.
Preamble
The purpose of this License is to make a manual, textbook, or other
functional and useful document
\emph{free} {\TermesIt free} % I have to insert this to print "free" italic
in the sense of freedom.
\end{document}
I'm translating an English text into German and I need to use different fonts for each language: For the German text, say, MyriadPro-Regular and for the English text, say, TeXGyreTermes-Regular. Inside both texts, I must use the \emph
command.
The sample text above is only a small part of the main text in which there are many lines of program codes, tables, etc. Because the main text is huge, I can't include it here. When I compile the main text with xelatex
it either prints some of the fonts incorrectly or gives compilation errors. When I use lualatex
it prints all of the fonts correctly and compiles fine so I need to use exclusively the lualatex
.
But when I use lualatex
, the \emph
or \textit
don't work. In order to make the italic texts, I need to set
\newfontfamily{\TermesIt}{TeXGyreTermes-Italic} and do {\TermesIt free}
which of course are cumbersome.
How to use the \emph
or \textit
in LuaLaTeX?
The questions below are related to the use of polyglossia
package and the \textcolor
and are not essential to the question above.
OPTIONAL: In order for the \textlang{german}
to use \MyriadPro
and for the \textlang{english}
to use the \Termes\small
, I need to set the \MyriadPro
and \Termes\small
lines repeatedly. Is there a way to set them once?
OPTIONAL 2: Lastly, I need to set the \textcolor{magenta}
for the \textlang{english}
but it causes the error as stated in the sample code. How to fix it?
Best Answer
You want to do