1
0

flake: bump nixpkgs, re-enable FiraCode+fontspec

* make sure lualatex is used consistently
* add checks for tex engine used and enable options conditionally
This commit is contained in:
surtur 2023-07-12 17:44:24 +02:00
parent 866feed655
commit 58748a992a
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI
4 changed files with 45 additions and 36 deletions

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1668288759,
"narHash": "sha256-olmFmG3er2sYTnwcZSjfxf/SiZo9mNgfGVA/O05DIIg=",
"lastModified": 1689174082,
"narHash": "sha256-8Xs1HEoptV84Ob4zcfuFY+JUn7PbjnsYce/3YUmlMJ0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "eda76eb80e5a98f1cfdfe925032aae251f812eef",
"rev": "9a1074ae6b2e76f8c1ae69a5c467f4097de85516",
"type": "github"
},
"original": {

@ -100,7 +100,7 @@
];
buildPhase = ''
pdflatex -synctex=1 -file-line-error \
lualatex -synctex=1 -file-line-error \
-interaction=nonstopmode -output-directory=$out thesis.tex
# handle bibliography.
@ -109,7 +109,7 @@
latexmk \
-pdf \
-pdflatex="pdflatex -file-line-error -interaction=nonstopmode" \
-pdflatex="lualatex -file-line-error -interaction=nonstopmode" \
-use-make thesis.tex
'';
installPhase = ''

@ -9,8 +9,15 @@
% =========================================================================== %
% BALÍČKY
%\usepackage[czech,english]{babel} % volba při kompilaci latexem (vyžaduje texlive-lang), zakomentovano, nastavovanu prikazem \nastavjazyk
\usepackage[czech,english]{babel} % volba při kompilaci latexem (vyžaduje texlive-lang), zakomentovano, nastavovanu prikazem \nastavjazyk
% \usepackage{draftwatermark}
\usepackage{iftex}
\iflualatex \OR \ifxelatex
\usepackage[T1]{fontspec}
\fi
\ifpdftex \OR \pdflatex
\usepackage[T1]{fontenc}% definice vnitřního kódování
\fi
\usepackage[utf8]{inputenc} % slouží pro definici kódování (při problémech zkusit zaměnit utf8x za utf8)
\usepackage{color} % umožňuje použití barev
\usepackage{graphicx} % rozšíření práce s grafikou
@ -34,26 +41,25 @@
%\usepackage{makeidx} % vytvoří rejstřík
\usepackage[pdftex,pdfa,hidelinks,breaklinks]{hyperref} % vytváří křížové odkazy
%\usepackage{multicol} % vícesloupcová sazba
%\usepackage{flafter} % zajistí, aby se plovoucí objekty objevovali až za jejich umístěním v textu
\usepackage{flafter} % zajistí, aby se plovoucí objekty objevovali až za jejich umístěním v textu
\usepackage{chngcntr} % Umožňuje změnu nastavení číslování obrázků, tabulek i rovnic
\usepackage{etoolbox} % Tool-box for LaTeX programmers
\usepackage[labelsep=space,tableposition=bottom,justification=centering]{caption} % Přenastavení popisků u figur a tabulek
\usepackage{xmpincl} % Pro aplikaci standardu PDF/A
% TODO(me):
% have this disabled when building draft documents with Nix - issue with
% everyshi version bundled in TexLive `ms` package that Nix bundles.
\usepackage{hyperxmp}[2020/03/01] % Pro aplikaci standardu PDF/A
\usepackage{pdfpages} % include raw PDF files directly
\usepackage{makecell} % multiline table cells
\usepackage{colorprofiles}
% \usepackage[a-2b,mathxmp]{pdfx}[2018/12/22]
% \usepackage[a-2b,mathxmp]{pdfx}[2018/12/22] % ignore the misadvice that this needs to be placed before hyperref
% \usepackage{fontspec}
%\setmonofont{Fira Code}[
% Scale=MatchLowercase,
% Contextuals=Alternate % Activate the calt feature
%]
% \usepackage{lstfiracode} % https://ctan.org/pkg/lstfiracode
% needs fontspec, i.e. also needs lualatex (or xelatex), not pdflatex.
\iflualatex \OR \ifxelatex
\setmonofont{Fira Code}[
Scale=MatchLowercase,
Contextuals=Alternate % Activate the calt feature
]
\fi
\usepackage{lstfiracode} % https://ctan.org/pkg/lstfiracode
% listings settings.
\lstset{
%style=FiraCodeStyle, % Use predefined FiraCodeStyle
@ -202,7 +208,7 @@
\providecommand{\xmpCreatorTool}{}%pdfTeX
\newcommand{\aplikujpdfa}{
\ifczech
\ifczech
\providecommand{\xmpTitle}{\nazevcz}
\providecommand{\xmpAuthor}{\autor}
\providecommand{\xmpKeywords}{\klicovaslovacz}
@ -220,7 +226,7 @@
% otherwise they go over the margin (known issue)
breaklinks=true
}
\else \ifenglish
\else \ifenglish
\providecommand{\xmpTitle}{\nazeven}
\providecommand{\xmpAuthor}{\autor}
\providecommand{\xmpKeywords}{\klicovaslovaen}
@ -240,16 +246,17 @@
}
\fi \fi
% https://tex.stackexchange.com/questions/42641/can-pdflatex-produce-pdf-a?noredirect=1&lq=1
% https://webpages.tuni.fi/latex/pdfa-guide.pdf
% \begin{filecontents*}[overwrite]{\jobname.xmpdata}
% \Title{\nazeven}
% \Author{\autor}
% \Language{en-GB}
% \Subject{\abstrakten}
% \Keywords{\klicovaslovaen}
%% https://tex.stackexchange.com/questions/42641/can-pdflatex-produce-pdf-a?noredirect=1&lq=1
%% https://webpages.tuni.fi/latex/pdfa-guide.pdf
% % \begin{filecontents*}[overwrite]{\jobname.xmpdata}
% \begin{filecontents*}[overwrite]{tex/pdfa-1b.xmpi}
% \Title{\nazeven}
% \Author{\autor}
% \Language{en-GB}
% \Subject{\abstrakten}
% \Keywords{\klicovaslovaen}
% \end{filecontents*}
%
% \makeatletter
% \includexmp{tex/pdfa-1b}
% \makeatother
@ -686,7 +693,7 @@
%{\renewcommand*\numberline[1]{Fig. \,#1\space}}
%\renewcommand*\l@figure{\@dottedtocline{1}{0em}{5.0em}}
%\renewcommand*\l@table{\@dottedtocline{1}{0em}{5.0em}}
\def\l@lstlisting#1#2{\@dottedtocline{1}{0em}{5.0em}{\lstlistingname\space#1}{#2}}
\def\l@lstlisting#1#2{\@dottedtocline{1}{0em}{5.0em}{List.\space#1}{#2}}
% Vynulování čítačů
\@addtoreset{table}{section}
@ -863,14 +870,14 @@
\addto\captionsczech{\renewcommand{\refname}{\MakeTextUppercase{Seznam použité literatury}}}
\addto\captionsczech{\renewcommand{\listfigurename}{\MakeTextUppercase{Seznam obrázků}}}
\addto\captionsczech{\renewcommand{\listtablename}{\MakeTextUppercase{Seznam tabulek}}}
\renewcommand{\lstlistlistingname}{\MakeTextUppercase{Seznam kódů}}
\addto\captionsczech{\renewcommand{\lstlistlistingname}{\MakeTextUppercase{Seznam kódů}}}
%\addto\captionsczech{\renewcommand{\figurename}{Obr.}}
%\addto\captionsczech{\renewcommand{\tablename}{Tab.}}
\renewcommand{\cftfigpresnum}{Obr. }
\else \ifenglish
\usepackage[UKenglish]{babel}
\selectlanguage{english}
% \hyphenpenalty 7000
\usepackage[UKenglish,slovak,czech]{babel}
% \selectlanguage{english}
% \hyphenpenalty 5000
\hyphenpenalty 7000
%\hyphenpenalty 9000
% \hyphenpenalty 10000
@ -880,9 +887,10 @@
\addto\captionsenglish{\renewcommand{\refname}{\MakeTextUppercase{References}}}
\addto\captionsenglish{\renewcommand{\listfigurename}{\MakeTextUppercase{List of Figures}}}
\addto\captionsenglish{\renewcommand{\listtablename}{\MakeTextUppercase{List of Tables}}}
\renewcommand{\lstlistlistingname}{List of Listings}
\addto\captionsenglish{\renewcommand{\lstlistlistingname}{\MakeTextUppercase{List of Listings}}}
%\addto\captionsenglish{\renewcommand{\figurename}{Fig.}}
%\addto\captionsenglish{\renewcommand{\tablename}{Tab.}}
\addto\captionsenglish{\renewcommand{\tablename}{Tab.}}
\addto\captionsenglish{\renewcommand{\lstlistingname}{Listing }}
\renewcommand{\cftfigpresnum}{Fig. }
\fi \fi
}

@ -3,7 +3,8 @@
% Šablona bakalářské/diplomové práce
%
% Autor: Ing. Jozef Říha (2006-05-04), od té doby šablonu udržuje
% Ing. Pavel Tomášek, Ph.D. (tomasek@utb.cz)
% Ing. Pavel Tomášek, Ph.D. (tomasek@utb.cz), ďalšie zmeny vykonal
% Adam Mirre (a_mirre AT utb DOT cz)
%
% Verze: 2021-05-04
%