Skip to content

Commit

Permalink
Fixed \newpdflayout
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomlourenco committed Mar 28, 2024
2 parents 11417f3 + 5e550e6 commit 96d1f6d
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 51 deletions.
10 changes: 8 additions & 2 deletions Chapters/appendix2.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@

\typeout{NT FILE appendix2.tex}%

\begin{newpdflayout}{210mm}{297mm}%{420mm}

\chapter{Appendix 2 Lorem Ipsum}
\label{app:lorem_ipsum2}

This is a test with citing something~\cite{ecoop12-dias} in the appendix.

\lipsum[1-10]
\begin{newpdflayout}{210mm}{297mm}%{420mm}

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

\lipsum[1-9]

BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
\end{newpdflayout}

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

\lipsum[1-10]
4 changes: 2 additions & 2 deletions NOVAthesisFiles/nt-version.sty
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
\newcommand*{\novathesisversion}{7.1.18}
\newcommand*{\novathesisdate}{2024-01-16}
\newcommand*{\novathesisversion}{7.1.19}
\newcommand*{\novathesisdate}{2024-03-28}
145 changes: 99 additions & 46 deletions novathesis.cls
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%% To view a copy of this license, visit
%% https://www.latex-project.org/lppl/lppl-1-3c/
%%
%% Version 2024-01-16 [7.1.18]
%% Version 2024-03-28 [7.1.19]
%% Departamento de Informática (www.di.fct.unl.pt)
%% Faculdade de Ciências e Tecnologia (www.fct.unl.pt)
%% Universidade NOVA de Lisboa (www.unl.pt)
Expand Down Expand Up @@ -54,7 +54,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\ProvidesClass{novathesis}[2024-01-16 novathesis template]
\ProvidesClass{novathesis}[2024-03-28 novathesis template]
\NeedsTeXFormat{LaTeX2e}[2020-02-02]


Expand Down Expand Up @@ -2235,21 +2235,91 @@
}

\newcommand*{\setpdftexpagesize}{%
\ifundef{\pdfpagewidth}{%
\ifundef{\pagewidth}{}{\pagewidth=\paperwidth}%
}{\pdfpagewidth=\paperwidth}%
\ifundef{\pdfpageheight}{%
\ifundef{\pageheight}{}{\pageheight=\paperheight}%
}{\pdfpageheight=\paperheight}%
\@ifundefined{pdfpageheight}{}{\pdfpageheight=\the\stockheight}
\@ifundefined{pdfpagewidth}{}{\pdfpagewidth=\the\stockwidth}
\@ifundefined{pageheight}{}{\pageheight=\the\stockheight}
\@ifundefined{pagewidth}{}{\pagewidth=\the\stockwidth}
\@ifundefined{pdfvorigin}{}{\ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi}
\@ifundefined{pdfhorigin}{}{\ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi}
% \ifundef{\pdfpagewidth}{%
% \ifundef{\pagewidth}{}{\pagewidth=\paperwidth}%
% }{\pdfpagewidth=\paperwidth}%
% \ifundef{\pdfpageheight}{%
% \ifundef{\pageheight}{}{\pageheight=\paperheight}%
% }{\pdfpageheight=\paperheight}%
}

\DeclareRobustCommand\nt@changelayout{%
\setlength{\@colht}{\textheight}
\setlength{\@colroom}{\textheight}%
\setlength{\vsize}{\textheight}
\setlength{\columnwidth}{\textwidth}%
\if@twocolumn%
\advance\columnwidth-\columnsep
\divide\columnwidth\tw@%
\@firstcolumntrue%
\fi%
\setlength{\hsize}{\columnwidth}%
\setlength{\linewidth}{\hsize}%
}%

\newcommand\nt@savelength[2]{%
\csappto{nt@restoregeometry@#1}{%
\expandafter\csname
#2\endcsname\expandafter=\expandafter\the\csname #2\endcsname\relax
}%
}
\newcommand\nt@saveboolean[2]{%
\csname if#2\endcsname
\csappto{nt@restoregeometry@#1}{%
\expandafter\noexpand\csname #1true\endcsname}%
\else
\csappto{nt@restoregeometry@#1\endcsname}{%
\expandafter\noexpand\csname #1false\endcsname}%
\fi
}%

\newcommand\nt@restoregeometry{%
\csuse{nt@restoregeometryB@\the\c@pdfnewlytlevel}%
\addtocounter{pdfnewlytlevel}{-1}%
}

\newcommand\nt@savegeometry{%
\addtocounter{pdfnewlytlevel}{1}%
\csgdef{nt@restoregeometryA@\the\c@pdfnewlytlevel}{}%
\nt@savelength{\the\c@pdfnewlytlevel}{paperwidth}%
\nt@savelength{\the\c@pdfnewlytlevel}{paperheight}%
\nt@savelength{\the\c@pdfnewlytlevel}{textwidth}%
\nt@savelength{\the\c@pdfnewlytlevel}{textheight}%
\nt@savelength{\the\c@pdfnewlytlevel}{evensidemargin}%
\nt@savelength{\the\c@pdfnewlytlevel}{oddsidemargin}%
\nt@savelength{\the\c@pdfnewlytlevel}{topmargin}%
\nt@savelength{\the\c@pdfnewlytlevel}{headheight}%
\nt@savelength{\the\c@pdfnewlytlevel}{headsep}%
\nt@savelength{\the\c@pdfnewlytlevel}{topskip}%
\nt@savelength{\the\c@pdfnewlytlevel}{footskip}%
\nt@savelength{\the\c@pdfnewlytlevel}{baselineskip}%
\nt@savelength{\the\c@pdfnewlytlevel}{marginparwidth}%
\nt@savelength{\the\c@pdfnewlytlevel}{marginparsep}%
\nt@savelength{\the\c@pdfnewlytlevel}{columnsep}%
\nt@savelength{\the\c@pdfnewlytlevel}{hoffset}%
\nt@savelength{\the\c@pdfnewlytlevel}{voffset}
\nt@saveboolean{\the\c@pdfnewlytlevel}{@twocolumn}%
\nt@saveboolean{\the\c@pdfnewlytlevel}{@twoside}%
\nt@saveboolean{\the\c@pdfnewlytlevel}{@mparswitch}%
\nt@saveboolean{\the\c@pdfnewlytlevel}{@reversemargin}%
}

\newcounter{pdfnewlytlevel}
\RequirePackage{atbegshi}
\newenvironment{newpdflayout}[3][]{%
% \typeout{textheight=\the\textheight}
% \typeout{textwidth=\the\textwidth}
% \AAAA
\nt@savegeometry%
\let\oldstockheight=\stockheight
\let\oldstockwidth=\stockwidth
\clearforchapter
\clearpage
\begingroup
\setstocksize{#2}{#3}
\settrimmedsize{#2}{#3}{*}
Expand All @@ -2270,47 +2340,30 @@
% \typeout{textheight=\the\textheight}
% \typeout{textwidth=\the\textwidth}
% \BBBB
\setlength{\@colht}{\textheight}
\setlength{\@colroom}{\textheight}%
\setlength{\vsize}{\textheight}
\setlength{\columnwidth}{\textwidth}%
\if@twocolumn%
\advance\columnwidth-\columnsep
\divide\columnwidth\tw@%
\@firstcolumntrue%
\fi%
\setlength{\hsize}{\columnwidth}%
\setlength{\linewidth}{\hsize}%
\nt@changelayout%
}{%
\clearforchapter%
\clearpage%
\endgroup%
\setstocksize{\oldstockheight}{\oldstockwidth}
\settrimmedsize{\oldstockheight}{\oldstockwidth}{*}
\paperwidth=\stockwidth
\paperheight=\stockheight
\setlrmarginsandblock%
{\themargin(\option{/novathesis/media},left)}%
{\themargin(\option{/novathesis/media},right)}%
{*}%
\setulmarginsandblock%
{\themargin(\option{/novathesis/media},top)}%
{\themargin(\option{/novathesis/media},bottom)}%
{*}%
\nt@restoregeometry
% \setstocksize{\oldstockheight}{\oldstockwidth}
% \settrimmedsize{\oldstockheight}{\oldstockwidth}{*}
% \paperwidth=\stockwidth
% \paperheight=\stockheight
% \setlrmarginsandblock%
% {\themargin(\option{/novathesis/media},left)}%
% {\themargin(\option{/novathesis/media},right)}%
% {*}%
% \setulmarginsandblock%
% {\themargin(\option{/novathesis/media},top)}%
% {\themargin(\option{/novathesis/media},bottom)}%
% {*}%
\checkandfixthelayout[fixed]
\setpdftexpagesize
% From geometry
\setlength{\@colht}{\textheight}
\setlength{\@colroom}{\textheight}%
\setlength{\vsize}{\textheight}
\setlength{\columnwidth}{\textwidth}%
\if@twocolumn%
\advance\columnwidth-\columnsep
\divide\columnwidth\tw@%
\@firstcolumntrue%
\fi%
\setlength{\hsize}{\columnwidth}%
\setlength{\linewidth}{\hsize}%
\clearforchapter%
\nt@changelayout
\clearpage%
\addtocounter{page}{-1}%
~\AtBeginShipoutDiscard
\clearpage
}


Expand Down
Binary file removed template.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%% To view a copy of this license, visit
%% https://www.latex-project.org/lppl/lppl-1-3c/
%%
%% Version 2024-01-16 [7.1.18]
%% Version 2024-03-28 [7.1.19]
%% Departamento de Informática (www.di.fct.unl.pt)
%% Faculdade de Ciências e Tecnologia (www.fct.unl.pt)
%% Universidade NOVA de Lisboa (www.unl.pt)
Expand Down

0 comments on commit 96d1f6d

Please sign in to comment.