From 58748a992a8956dc402fb60193bf5b5f347ffd91 Mon Sep 17 00:00:00 2001 From: surtur Date: Wed, 12 Jul 2023 17:44:24 +0200 Subject: [PATCH] flake: bump nixpkgs, re-enable FiraCode+fontspec * make sure lualatex is used consistently * add checks for tex engine used and enable options conditionally --- flake.lock | 6 ++--- flake.nix | 4 ++-- tex/UTB.tex | 68 ++++++++++++++++++++++++++++++----------------------- thesis.tex | 3 ++- 4 files changed, 45 insertions(+), 36 deletions(-) diff --git a/flake.lock b/flake.lock index b7db1d4..476c4ac 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/flake.nix b/flake.nix index fd2aa8c..1124fe2 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = '' diff --git a/tex/UTB.tex b/tex/UTB.tex index 4836acd..3fc5bbe 100644 --- a/tex/UTB.tex +++ b/tex/UTB.tex @@ -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 } diff --git a/thesis.tex b/thesis.tex index afb3df6..03f3575 100644 --- a/thesis.tex +++ b/thesis.tex @@ -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 %