# Swapping from pdfLaTeX to XeLaTex

This forum has always been a great source of quick and sophisticated help. So I hope you can show me how it's done once again!

I will soon have to write my final thesis at university and up until now I managed to get along with pdfLaTeX quite well and I grew very fond of it. But now the problems I cannot seem to resolve start to pile up, mostly due to different languages I have to use in one text. So everybody keeps suggesting that I should change to XeLaTeX because it handles different fonts/languages better. On the other hand I have an extensive preamble (mostly because I need a quite 'special' kind of bibliography) and I cannot find out which packages are compatible with XeLaTeX and which are not or if there are better options.

I have already read the thread Moving from pdfLaTeX to XeTeX - what do I need to know? and Using XeLaTeX instead of pdfLaTeX but they don't cover everything I need...

%Preamble%

\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}

\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2cm,footskip=1cm]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{caption}
\usepackage{filecontents}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{yfonts}
\usepackage{hyperref}
\usepackage{pdfpages}
%\usepackage{showframe}
\usepackage{lipsum}

%%Tables%%
\usepackage{array,booktabs,xcolor,colortbl}
\usepackage{multirow}
\usepackage{diagbox}
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

%%Encoding%%
\usepackage{lmodern}
\usepackage[footnote,printonlyused]{acronym}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{tipa}
\usepackage{csquotes}
\usepackage{combelow}

%%Footnotes%%
\usepackage{footnote}
\makesavenoteenv{tabular}
\makesavenoteenv{table}
\setkomafont{disposition}{\mdseries\rmfamily}
\onehalfspacing
\captionsetup[table]{skip=5pt,font=footnotesize}
\deffootnote[1.0em]{1.0em}{1.0em}
{\textsuperscript{\thefootnotemark}\,\enskip}
\renewcommand{\baselinestretch}{1.5}

%%Inhaltverzeichnis%%
\usepackage{tocstyle}
\usetocstyle{allwithdot}

%%Bibliography%%
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage[backend=biber,style=authoryear,sorting=nyt]{biblatex}
\DefineBibliographyStrings{ngerman}{references={Bibliographie}}
\DeclareFieldFormat{superedition}{\textsuperscript{#1}}
\DeclareNameAlias{sortname}{last-first}
\renewbibmacro*{date+extrayear}{%
\iffieldundef{\thefield{datelabelsource}year}%
{}{%
\printtext[parens]{%
\iffieldnum{edition}{\printfield[superedition]{edition}\global\clearfield{edition}}{}%
\iffieldsequal{year}{\thefield{datelabelsource}year}%
{\printdateextralabel}{\printfield{labelyear}\printfield{extrayear}}%
}%
}%
}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}{%
\printnames[byeditor]{editor}%
\clearname{editor}\newunit%
}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}%
}
\renewbibmacro*{bytypestrg}[2]{%
\iffieldundef{#1type}{\bibstring{#2}}{%
\ifbibxstring{\thefield{#1type}}%
{\bibstring{\thefield{#1type}}}{\printtext{\thefield{#1type}}}%
}%
}
\renewcommand*{\multinamedelim}{/}
\renewcommand*{\finalnamedelim}{/}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\newcounter{SprachB}
\newcommand{\SprachB}[1]{\refstepcounter{SprachB}\label{#1}}

\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\singlespacing\footnotesize}

\DeclareRobustCommand{\cyrins}[1]{
\begingroup\fontencoding{T2A}%
\begingroup\fontfamily{cmr}%
\foreignlanguage{russian}{#1}%
\endgroup\endgroup
}

\hyphenation{Script-Oralia}

%Document%

\begin{document}

\pagenumbering{arabic}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[R]{\thepage\hspace{.5cm}}
\setcounter{page}{3}

\begin{spacing}{1.3}

\lipsum

\end{spacing}

\end{document}


All in all I want to be able to use:

• mostly German in the main text
• Romanian because that's the language I'm studying (special characters needed!)
• other unproblematic european languages like English, French and Portuguese
• IPA-symbols since the thesis is about phonology
• Cyrillic characters that can be found on a standard keyboard today
• old Cyrillic (and Glagolitic) characters
• Japanese characters (Hiragana, Katakana and Kanji)

I really hope this is not too big a problem because my thesis on writing and phonology will be hard to manage without the list above.

Of course, if you can think of a way to do all that in pdfLaTeX then I'd be happy to try it as well.

Two final pieces of information: I'm using the TexMaker (but I could move to another compiler if that makes anything easier) and OpenSuse is my OS (so I'm not sure if all extensions are available for me to download)

Thank you so much in advance!!

• You still have fontenc there, don't! For xetex replace babel with polyglossia. The Romanian characters can just be input as utf8. For any other language you have to look for the (existing) posts here that describe it in detail. Aug 7 '17 at 15:47
• Also look into LuaLaTeX, which deals with fonts as well as XeLaTeX but has additional features.
– JPi
Aug 7 '17 at 16:22
• It's not clear to me what the question you wanna ask is. Aug 7 '17 at 18:06
• Somewhat slow, depending on the circumstances, but with XeLaTeX you don't get microtype, you don't get Lua.
– JPi
Aug 7 '17 at 19:34
• @LeonMeier That's why there are different engines: different people have different needs. I use both Lua and microtype all the time.
– JPi
Aug 7 '17 at 19:55

• mostly German in the main text

You can achieve this using pdfLaTeX, XeLaTeX and LuaLaTeX in similar quality. Keep in mind that for a German thesis you can use babel with the ngerman option or polyglossia (not with pdflatex) with its german language.

• Romanian because that's the language I'm studying (special characters needed!)

It's no problem to use any UTF-8 characters (with accents etc.) in Xe-/LuaLaTeX. Only important note: Your font has to support it. If you choose a font without the characters the engine decision won't help.

• other unproblematic european languages like English, French and Portuguese

Those languages are supported by babel and polyglossia. You may want to read the manuals to decide which way of switching the languages is more to your liking.

• IPA-symbols since the thesis is about phonology

You can use the methods described in How to use phonetic IPA characters in LaTeX. That would work with pdflatex and Xe-/LuaLaTeX. In my opinion (only personal) the unicode input seems more comfortable, but that's a matter of preference.

• Cyrillic characters that can be found on a standard keyboard today

I don't know which characters you do want to use. But in general you can use the options from Cyrillic in (La)TeX. If I had to switch between many languages with different symbols, I would definitely go with Xe-/LuaLaTeX here.

• old Cyrillic (and Glagolitic) characters

This seems to be a perfect task for Xe-/LuaLaTeX. Just input the characters in UTF-8 and search for a font which maps it to the correct "old characters".

• Japanese characters (Hiragana, Katakana and Kanji)

As I recommended Xe-/LuaLaTeX before for font switching, you should read this answer. Personally I have very good experiences with luatexja-fontspec.

Recommendation: I would, after considering your points, go with Xe-/LuaLaTeX. Now you'd have to decide which one you'd like to use. I've used XeLaTeX for a while, but am now a LuaLaTeX user, as on my machine I do not have those large speed differences (on big documents).

As I'm a microtype user and as I manipulate input to fit my needs (e.g. transform every z.B. into z.\,B.) I use LuaLaTeX for bigger projects. If you do not need those manipulations, XeLaTeX will suffice.

Concerning your source code (given you switch to Xe-/LuaLaTeX):

• remove inputenc (encoding is UTF-8 eitherway) and fontenc (unsupported concept)
• replace lmodern with a respective fontspec call
• update your \cyrins command to swith font and not encoding
• (optional) replace fancyhdr with the KOMA native scrlayer-scrpage

Btw: replace means you should read the documentation and use the way given there.

Update: I've modified your code a bit to serve as starter for the transition to XeLaTeX.

In the last edit I removed the dependency on Arial and make use of the Libertinus Serif font which is included in TeX Live.

\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}

\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2cm,footskip=1cm]{geometry}

\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\setsansfont{Latin Modern Sans}
\setmonofont{Latin Modern Mono}
\newfontfamily\russianfont{Libertinus Serif}
\newfontfamily\ipafont{DoulosSIL-R.ttf}

\usepackage{polyglossia}
\setdefaultlanguage{german}
\setotherlanguages{russian,romanian}
\usepackage[style=german]{csquotes}

\usepackage{yfonts}
\usepackage{tipa}
% \usepackage{combelow} don't know whether it's compatible

\usepackage{setspace}
\usepackage{filecontents}

\usepackage{graphicx}
\usepackage{caption}
\captionsetup[table]{skip=5pt,font=footnotesize}

%%Tables%%
\usepackage{array}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{diagbox}
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

\usepackage{lipsum}

\usepackage{pdfpages}
\usepackage{hyperref}

\usepackage[footnote,printonlyused]{acronym}
\usepackage{footnote}
\makesavenoteenv{tabular}
\makesavenoteenv{table}
\deffootnote[1.0em]{1.0em}{1.0em}
{\textsuperscript{\thefootnotemark}\,\enskip}

\setkomafont{disposition}{\mdseries\rmfamily}
\onehalfspacing
\renewcommand{\baselinestretch}{1.5}

\usepackage{tocbasic}
\KOMAoptions{toc=sectionentrydotfill} % replaces the experimental tocstyle (if you do not need dots for parts)
%\usepackage{tocstyle}
%\usetocstyle{allwithdot}

%%Bibliography%%
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage[backend=biber,style=authoryear,sorting=nyt]{biblatex}
\DefineBibliographyStrings{ngerman}{references={Bibliographie}}
\DeclareFieldFormat{superedition}{\textsuperscript{#1}}
\DeclareNameAlias{sortname}{last-first}
\renewbibmacro*{date+extrayear}{%
\iffieldundef{\thefield{datelabelsource}year}%
{}{%
\printtext[parens]{%
\iffieldnum{edition}{\printfield[superedition]{edition}\global\clearfield{edition}}{}%
\iffieldsequal{year}{\thefield{datelabelsource}year}%
{\printdateextralabel}{\printfield{labelyear}\printfield{extrayear}}%
}%
}%
}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}{%
\printnames[byeditor]{editor}%
\clearname{editor}\newunit%
}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}%
}
\renewbibmacro*{bytypestrg}[2]{%
\iffieldundef{#1type}{\bibstring{#2}}{%
\ifbibxstring{\thefield{#1type}}%
{\bibstring{\thefield{#1type}}}{\printtext{\thefield{#1type}}}%
}%
}
\renewcommand*{\multinamedelim}{/}
\renewcommand*{\finalnamedelim}{/}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\newcounter{SprachB}
\newcommand{\SprachB}[1]{\refstepcounter{SprachB}\label{#1}}

\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\singlespacing\footnotesize}

\DeclareRobustCommand{\cyrins}[1]{
{\russianfont\textrussian{#1}}%
}

\hyphenation{Script-Oralia}

\pagenumbering{arabic}
\cfoot{}
\ofoot{\pagemark}

\begin{document}
\setcounter{page}{3}
\begin{spacing}{1.3}

\lipsum

\cyrins{Лорем ипсум долор сит амет, меи ид бонорум инцоррупте диссентиас, пер еа елигенди тациматес ехпетендис. Регионе торяуатос ассуеверит ад еос. Яуем прима интеллегебат еос ат. Синт молестиае интерессет ут нам, сеа цу саепе лаборес патриояуе.}

IPA: {\ipafont [ɪtsɹilijizitutaɪp]}

\end{spacing}

\end{document}

• @TeXnician There seems to be a problem with creating the bibliography now =/ it produces this error message: "KonSysRum.aux I found no \bibdata command---while reading file KonSysRum.aux I found no \bibstyle command---while reading file KonSysRum.aux" -- I have deleted the old aux-file (as it was suggested on other pages) but that didn't help. the code for my bibliography is quite long and I'm not sure where the problem lies. I've already tried to change "ngerman" "german" (the first one is babel?) and changed the way I quote from mostly \parencite* to \cite but still get the same error =/ Aug 9 '17 at 21:35
• @LeonMeier Nobody forces you. If you do not like my answer you already have said so. You can use it or you can leave it. However, your comments are really not productive as you do not even suggest an alternative. If you'd like to provide a better example, feel free to do so. Then you can ping the OP and ask if he thinks your answer is better (he might accept it then). Aug 10 '17 at 18:38
• @LeonMeier I've clearly built my suggestion upon the linked posts which should be read. As in the linked post the named font is to be downloaded, I've done it the same way. And for the current document I did not check for LuaLaTeX compatibility (I suppose that it is a problem with the many font packages). But as I mentioned, it would be a good idea to post what works for you (based on OP). Aug 11 '17 at 4:30
• @LeonMeier you clearly have some gripe against xetex. While it's true that neither xetex nor luatex are as stable as classic tex, neither is "hoplessly broken" and many people have been making documents with both systems for many years, so while tl2017 has a few fixes for obscure a bugs a tl2016 installation should be fine for the vast majority of uses. Aug 11 '17 at 16:28
• @LeonMeier "above you see the error messages I get" ??? I see no error messages that you show other than font not found which is rather unlikely to be related to any xetex bug, Arial is of course not found on linux (unless you bought it) and for the others it is usually a matter of configuring fontconfig. Aug 11 '17 at 18:39