From 88a071c15da06e6ad701eabbbcad432d44378d9d Mon Sep 17 00:00:00 2001 From: witiko <witiko@gmail.com> Date: Sun, 10 May 2015 00:34:02 +0200 Subject: [PATCH] Added LuaTeX support. --- Makefile | 9 ++++++-- fithesis3/fithesis.dtx | 12 ++++++---- fithesis3/guide/mu/guide.bib | 5 ++-- fithesis3/guide/mu/guide.tex | 44 ++++++++++++++++++++---------------- fithesis3/style/mu/base.dtx | 31 ++++++++++++++++++++----- fithesis3/test/Makefile | 7 +++--- lualatex.tex | 2 ++ pdflatex.tex | 2 +- xelatex.tex | 2 +- 9 files changed, 73 insertions(+), 41 deletions(-) create mode 100644 lualatex.tex diff --git a/Makefile b/Makefile index 6e86103..be41be8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: all clear all: make -C fithesis3 - make pdflatex.pdf xelatex.pdf clear + make pdflatex.pdf xelatex.pdf lualatex.pdf clear # This target typesets the pdfLaTeX example. pdflatex.pdf: pdflatex.tex @@ -13,6 +13,11 @@ xelatex.pdf: xelatex.tex xelatex $< xelatex $< +# This target typesets the LuaLaTeX example. +lualatex.pdf: lualatex.tex + lualatex $< + lualatex $< + # This target removes any auxiliary files. clear: rm -f *.aux *.log *.out *.toc *.lot *.lof @@ -20,4 +25,4 @@ clear: # This target removes any auxiliary files # and the output PDF file. implode: clear - rm -f pdflatex.pdf xelatex.pdf + rm -f pdflatex.pdf xelatex.pdf lualatex.pdf diff --git a/fithesis3/fithesis.dtx b/fithesis3/fithesis.dtx index 394d1e2..4272897 100644 --- a/fithesis3/fithesis.dtx +++ b/fithesis3/fithesis.dtx @@ -72,7 +72,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e} % \fi -\def\thesis@version{2015/04/26 v0.3.10 fithesis3 MU thesis class} +\def\thesis@version{2015/05/09 v0.3.10 fithesis3 MU thesis class} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -185,11 +185,12 @@ % code after the preamble. % \item\textsf{ifxetex} -- Used to detect the \Hologo{XeTeX} % engine. +% \item\textsf{ifluatex} -- Used to detect the \Hologo{LuaTeX} +% engine. % \item\textsf{inputenc} -- Used to enable the input utf-8 % encoding. This package does not get loaded under -% \Hologo{XeTeX}. +% \Hologo{XeTeX} and \Hologo{LuaTeX}. % \end{itemize} -% for string parsing and comparisons. % The \texttt{hyperref} package is also conditionally loaded during % the expansion of the |\thesis@load| macro (see section % \ref{sec:thesis@load}). Other packages may be required by the @@ -200,9 +201,10 @@ \RequirePackage{keyval} \RequirePackage{etoolbox} \RequirePackage{ifxetex} -\ifxetex\else +\RequirePackage{ifluatex} +\ifxetex\else\ifluatex\else \RequirePackage[utf8]{inputenc} -\fi +\fi\fi % \end{macrocode} % \section{Public API} % \label{sec:public-api} diff --git a/fithesis3/guide/mu/guide.bib b/fithesis3/guide/mu/guide.bib index 70c9190..f08fab5 100644 --- a/fithesis3/guide/mu/guide.bib +++ b/fithesis3/guide/mu/guide.bib @@ -48,6 +48,5 @@ Sojka}, title={The \textsf{fithesis3} class for the typesetting of theses written at the Masaryk Univerzity in Brno}, - year={\the\year}, - month={\the\month}, - place={Brno}} + place={Brno}, + year={2015}} diff --git a/fithesis3/guide/mu/guide.tex b/fithesis3/guide/mu/guide.tex index b19ca68..2b5fb3a 100644 --- a/fithesis3/guide/mu/guide.tex +++ b/fithesis3/guide/mu/guide.tex @@ -74,7 +74,8 @@ class\footnote{See \url{https://www.ctan.org/pkg/ntgclass}} and the following packages:\begin{itemize} - \item\textsf{keyval}, \textsf{etoolbox}, \textsf{ifxetex} + \item\textsf{keyval}, \textsf{etoolbox}, \textsf{ifxetex}, + \textsf{ifluatex} \item\textsf{inputenc} -- only when typesetting with \TeX{} or \hologo{pdfTeX} \end{itemize} In order to be able to use the \textsf{fithesis3} @@ -92,7 +93,7 @@ \thguide@prnpkg{setspace}% \thguide@prnpkg{geometry}} \item\textsf{fontspec}, \textsf{unicode-math} -- only when - typesetting with \Hologo{XeTeX} + typesetting with \Hologo{XeTeX} or \Hologo{LuaTeX} \item\textsf{mathpazo}, \textsf{tgpagella}, \textsf{lmodern}, \textsf{cmap}, \textsf{fontenc} -- only when typesetting with \TeX{} or \hologo{pdfTeX} @@ -104,9 +105,9 @@ \url{https://www.ctan.org/pkg/tex-gyre-pagella}} and \TeX{} Gyre Pagella Math\footnote{See \url{https://www.ctan.org/pkg/tex-gyre-math-pagella}} OpenType - fonts are also required, when typesetting with \Hologo{XeTeX}. - All these are likely to be a part of any reasonably modern \TeX{} - distribution. + fonts are also required, when typesetting with \Hologo{XeTeX} or + \Hologo{LuaTeX}. All these are likely to be a part of any + reasonably modern \TeX{} distribution. \section{Installation} This section covers the installation of the \textsf{fithesis3} @@ -127,7 +128,7 @@ is not a part of your \TeX{} distribution already. This can be easily verified by creating the minimal document described in the next section and - typesetting it using either the \Hologo{XeTeX} or + typesetting it using either the \Hologo{XeTeX}, \Hologo{LuaTeX} or the \hologo{pdfTeX} engine, respectively. In case \textsf{fithesis3} is not a part of your \TeX{} distribution, the typesetting will prematurely terminate with the @@ -163,14 +164,14 @@ Hello world! \end{document} \end{minted} - Now typeset the document using either the \hologo{pdfLaTeX} or - the \Hologo{XeLaTeX} engine. If everything is set up correctly, - you should end up with a document containing all the mandatory - parts of a thesis and one page at the end containing a - \texttt{Hello world!} line. You should notice that the document - is implicitly typeset in English and that it contains lots of - placeholder stringss for missing metadata (see Figure - \ref{fig:example01}). In the next chapter, we are going to + Now typeset the document using either the \hologo{pdfTeX} or the + \Hologo{XeTeX} engine with the \LaTeX{} format. If everything is + set up correctly, you should end up with a document containing + all the mandatory parts of a thesis and one page at the end + containing a \texttt{Hello world!} line. You should notice that + the document is implicitly typeset in English and that it + contains lots of placeholder stringss for missing metadata (see + Figure \ref{fig:example01}). In the next chapter, we are going to address that. \begin{figure}[!bt] \centering\makeatletter @@ -220,11 +221,13 @@ are going to be typeset in Czech. \end{document} \end{minted} - The \textsf{babel} package can be used with Latin scripts, while - the \textsf{polyglossia} package supports non-Latin scripts as - well and is intended as a replacement of \textsf{babel} for - \Hologo{XeLaTeX}. You are advised to use one of them, depending - on your requirements. + At the time of writing this text, \textsf{polyglossia} can only + be used with \Hologo{XeTeX}, whereas \textsf{babel} can be used + with \hologo{pdfTeX}, \Hologo{XeTeX} and \Hologo{LuaTeX}. On the + ther hand, the \textsf{babel} package can only be used with Latin + scripts, while the \textsf{polyglossia} package supports + non-Latin scripts as well. You are advised to use one of them, + depending on your choice of \TeX{} engine and requirements. \section{Inserting metadata} Next, we are going to insert some metadata into the document. The @@ -379,6 +382,9 @@ \begin{document} \end{document} \end{minted} + + This technique can also be used to override the default font, + which would be otherwise bothersome. \section{Changing the layout} If you are unsatisfied with the arrangement of the mandatory diff --git a/fithesis3/style/mu/base.dtx b/fithesis3/style/mu/base.dtx index 27a170c..72a8a59 100644 --- a/fithesis3/style/mu/base.dtx +++ b/fithesis3/style/mu/base.dtx @@ -114,6 +114,8 @@ % \item\textsf{xcolor} -- Adds support for color manipulation. % \item\textsf{ifxetex} -- Used to detect the \Hologo{XeTeX} % engine. +% \item\textsf{ifluatex} -- Used to detect the \Hologo{LuaTeX} +% engine. % \item\textsf{graphix} -- Adds support for the inclusion of % graphics files. % \item\textsf{pdfpages} -- Adds support for the injection of PDF @@ -130,21 +132,38 @@ \thesis@require{pdfpages} \thesis@require{keyval} \thesis@require{ifxetex} +\thesis@require{ifluatex} +% \end{macrocode} +% Using the |\ifxetex| and |\ifluatex| conditionals, a compound +% \DescribeMacro{\thesis@ifxeluatex}|\thesis@ifxeluatex| +% conditional was constructed. This conditional can be used by +% subsequently loaded style files to test for either the +% \Hologo{XeTeX} or \Hologo{LuaTeX} engline being used. +% \begin{macrocode} +\def\thesis@ifxeluatex{{% + \let\x\expandafter\let\f\csname\let\t\endcsname + \ifxetex\x\f\x i\x f\x t\x r\x u\x e\x\t + \else + \ifluatex\x\x\x\f\x\x\x i\x\x\x f\x\x\x t\x\x\x r% + \x\x\x u\x\x\x e\x\x\x\t + \else \x\x\x\f\x\x\x i\x\x\x f\x\x\x f\x\x\x a% + \x\x\x l\x\x\x s\x\x\x e\x\x\x\t + \fi + \fi}} % \end{macrocode} % The following packages get only loaded, when the document is -% being typeset using the \Hologo{XeTeX} engine: \begin{itemize} +% being typeset using the \Hologo{XeTeX} or \Hologo{LuaTeX} +% engine: \begin{itemize} % \item\textsf{fontspec} -- Allows the selection of -% system-installed fonts. This package only gets loaded under -% \Hologo{XeTeX}. +% system-installed fonts. % \item\textsf{unicode-math} -- Allows the selection of -% system-installed mathematical fonts. This package only gets -% loaded under \Hologo{XeTeX}. +% system-installed mathematical fonts. % \end{itemize} % Under \Hologo{XeTeX}, the \textsf{TeX Gyre Pagella} and % \textsf{TeX Gyre Pagella Math} are also selected as the main text % and math fonts. % \begin{macrocode} -\ifxetex +\thesis@ifxeluatex \thesis@require{fontspec} \thesis@require{unicode-math} \setmainfont[Ligatures=TeX]{TeX Gyre Pagella} diff --git a/fithesis3/test/Makefile b/fithesis3/test/Makefile index 446a743..a9e90f5 100644 --- a/fithesis3/test/Makefile +++ b/fithesis3/test/Makefile @@ -2,10 +2,9 @@ all: clean for file in *.tex; do \ ln -s "$$file" current.tex && \ - pdflatex current && \ - pdflatex current && \ - xelatex current && \ - xelatex current && \ + pdflatex current && pdflatex current && \ + xelatex current && xelatex current && \ + lualatex current && lualatex current && \ rm current.*; \ done diff --git a/lualatex.tex b/lualatex.tex new file mode 100644 index 0000000..17323de --- /dev/null +++ b/lualatex.tex @@ -0,0 +1,2 @@ +% This file is just a symbolic link to the xelatex.tex file. +\input xelatex diff --git a/pdflatex.tex b/pdflatex.tex index 3644a5e..db28448 100644 --- a/pdflatex.tex +++ b/pdflatex.tex @@ -8,7 +8,7 @@ \chapter{Foo bar} Hello world! \begin{equation} - \tag{Mass–energy equivalence} e=mc^2 + \tag{Mass--energy equivalence} e=mc^2 \end{equation} \begin{center} \begin{tabularx}{\textwidth}{lllX} diff --git a/xelatex.tex b/xelatex.tex index 297eff6..194a052 100644 --- a/xelatex.tex +++ b/xelatex.tex @@ -9,7 +9,7 @@ \chapter{Foo bar} Hello world! \begin{equation} - \tag{Mass–energy equivalence} e=mc^2 + \tag{Mass--energy equivalence} e=mc^2 \end{equation} \begin{center} \begin{tabularx}{\textwidth}{lllX} -- GitLab