Skip to content
Snippets Groups Projects
Commit 5d190295 authored by Jari-Matti Mäkelä's avatar Jari-Matti Mäkelä
Browse files

Merge branch 'zref-pagenumbers' into 'master'

Zref pagenumbers

See merge request !7
parents fda72f2a 3842488e
No related branches found
No related tags found
1 merge request!7Zref pagenumbers
Pipeline #26423 passed
# see https://hub.docker.com/repository/docker/konttipoju/tinytex
image: konttipoju/tinytex:2019-12g
image: konttipoju/tinytex:2020-04a
# first we build the PDF, then validate it
stages:
......
......@@ -8,7 +8,7 @@
# files. In addition, minted requires some tuning to support different
# output directories.
image: konttipoju/tinytex:2019-12g
image: konttipoju/tinytex:2020-04a
stages:
- prepare
......
......@@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive
# combine into one run command to reduce image size
RUN mkdir -p /usr/share/man/man1 && apt-get update && \
apt-get install -y perl wget libfontconfig1 openjdk-11-jre-headless poppler-utils python3-pygments && \
apt-get install -y perl wget libfontconfig1 openjdk-11-jre-headless poppler-utils python3-pygments pandoc && \
wget -qO- "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh && \
apt-get clean
......@@ -16,11 +16,11 @@ RUN tlmgr update --self && tlmgr install xetex scheme-small && fmtutil-sys --all
# install only the packages you need
RUN tlmgr install adjustbox collectbox biblatex tracklang biblatex-ieee csquotes datetime2 \
datetime2-english datetime2-finnish biber xstring units lastpage comment genmisc \
datetime2-english datetime2-finnish biber xstring units lastpage comment \
fontawesome chessboard skak glossaries datenumber datetime advdate multido todonotes \
semantic syntax wasysym dashrule titlecaps pdfx ifnextok xmpincl blindtext minted \
fvextra catchfile includernw algorithm2e shapepar hanging sectionbox euro nag nomencl \
filecontents && tlmgr path add
filecontents zref && tlmgr path add
RUN wget http://ftdev.utu.fi/downloads/resources/greenfield-apps-1.15.0-SNAPSHOT.jar -O /validator.jar && \
echo 'java -cp /validator.jar org.verapdf.apps.GreenfieldCliWrapper --format text -v "$@"' > /root/bin/pdfa-validate && \
......
......@@ -39,8 +39,8 @@
\RequirePackage{ifthen} % mainly: \langchoose and \switch (\ifstrequal doesn't work here?)
\RequirePackage{ifxetex} % for xelatex/pdflatex font selection
\RequirePackage{fancyhdr} % customized headers/footers
\RequirePackage{xstring} % string operations (parse the number of pages etc.)
\RequirePackage[page]{totalcount} % the total number of pages (another option: zref-lastpage, @see https://tex.stackexchange.com/a/220564)
\RequirePackage{xstring} % string comparison
\RequirePackage[lastpage,totpages,user]{zref} % page counting logic
%% Custom package options
%\DeclareStringOption[00]{year}
......@@ -132,8 +132,6 @@
\setmainfont{\utuftthesis@mainfont}
}
}
\fi
\ifxetex
\else
% JH: modified latin to UTF-8 encoding cues to make Scandinavian characters work
\RequirePackage[T1]{fontenc}
......@@ -369,11 +367,7 @@
%% Modify the \printbibliography command
\defbibheading{bibliography}[\refs]{
\ifutuftthesis@countbibpages
\else
% label here if we don't include the bibliography in the page count
\label{endofpages}
\fi
\zlabel{endofmaincontent}
\chapter*{#1}
\markboth{\MakeUppercase{#1}}{}
\addcontentsline{toc}{chapter}{#1}
......@@ -384,10 +378,7 @@
\renewcommand{\printbibliography}{
\oldprintbibliography
% label here if we include the bibliography in the page count
\ifutuftthesis@countbibpages
\label{endofpages}
\fi
\zlabel{endofbibliography}
\langfin{
\expandafter\selectlanguage\expandafter{\n@tivelang}
}{
......@@ -470,10 +461,6 @@
\clearpage
}
%% used to detect the empty \totalpages on the first latex run
%% @see http://ftp.acc.umu.se/mirror/CTAN/macros/generic/xstring/xstring-en.pdf
\newcommand*{\IsInteger}[3]{\IfStrEq{#1}{ }{}{\IfInteger{#1}{#2}{#3}}}
%% top part of the abstract page (since we use environments)
\newcommand{\@bstracth}[1]{%
\selectlanguage{#1}
......@@ -491,15 +478,14 @@
\item[\textsc{\@author}] \@title
\end{entry}
\thesistype{#1}, %
\IsInteger{\totalpages}{%
\pageref{endofpages} \pagesname{#1}%
\ifnum \totalpages > 0
, \totalpages\ \apppagesname{#1} \\
\ifutuftthesis@countbibpages
\zref@extractdefault{endofbibliography}{page}{\zref@extractdefault{LastPage}{page}{0}} \pagesname{#1}%
\else
\\
\zref@extractdefault{endofmaincontent}{page}{\zref@extractdefault{LastPage}{page}{0}} \pagesname{#1}%
\fi
}{ \runagain{#1} \\
}
\newcommand\lastapppage{\zref@extractdefault{appendices}{abspage}{999}}%
\newcommand\apppagecount{\number\numexpr \ztotpages - \lastapppage + 1\relax}%
\IfStrEq*{\lastapppage}{999}{}{, \apppagecount\ \apppagesname{#1}} \\
\labname{#1} \\
\monthname{#1}{\m@nth} \ye@r\\
\rule{\linewidth}{1 pt}
......@@ -557,9 +543,6 @@
\rhead{\thepage}
\fancyfoot{}
\cfoot{\version}
% the totalcount counter is only used for counting the appendices
% warning: fails if the document has over 65000 pages
\setcounter{totalcount@page}{-65000}
}
%% postpone the doc style through these sections
......@@ -582,18 +565,16 @@
\renewcommand{\appendices}{}
\clearpage
\appendix
\zlabel{appendices}
\addtocontents{toc}{\protect\contentsline{chapter}{\appname}{}\relax}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\appendixname\ \thechapter.\ ##1}}{}}
\rhead{\thechapter-\arabic{page}}
\setcounter{page}{0}
\renewcommand\thepage{\thechapter-\arabic{page}}
\setcounter{totalcount@page}{\utuftthesis@pagecountdelta}
}
%% use in place of \chapter
\newcommand{\appchapter}[1]{%
\appendices
\addtocounter{totalcount@page}{\value{page}}
\clearpage
\setcounter{page}{1}
\chapter{#1}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment