summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-02-23 22:17:01 +0000
committerKarl Berry <karl@freefriends.org>2019-02-23 22:17:01 +0000
commitc714634364a1153c6b21311a21d79fc932181ecc (patch)
tree164cbec9f2831360c71ad42790b34432eac0b7e0 /Master/texmf-dist/tex
parent28403cf284b6470974feb06d05fa84b83efcbe0c (diff)
pdfreview (22feb19)
git-svn-id: svn://tug.org/texlive/trunk@50100 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/pdfreview/pdfreview.sty387
1 files changed, 286 insertions, 101 deletions
diff --git a/Master/texmf-dist/tex/latex/pdfreview/pdfreview.sty b/Master/texmf-dist/tex/latex/pdfreview/pdfreview.sty
index 7b22a61cf1f..c307557fd4f 100644
--- a/Master/texmf-dist/tex/latex/pdfreview/pdfreview.sty
+++ b/Master/texmf-dist/tex/latex/pdfreview/pdfreview.sty
@@ -2,22 +2,41 @@
% (see \url{http://www.latex-project.org/lppl.txt}).
% Please report bugs to the author (Michael Palmer, mpalmer@uwaterloo.ca)
+% modifications since 1.1:
+% - added second optional argument to \note (tikz code)
+% - expunged package ifthen, since we require etoolbox anyway
+% - added package name to default pdfcreator string
+% - added 'important' option for applying different note formatting
+% - added 'staggered' option to prevent overlapping placement of notes
+% - added 'scaletopage' option to pick a page other than the first one
+% in case that one has an atypical size, as sometimes happens.
+% - added \pagegrid user macro to draw a grid of helplines over top
+% the included source page.
+
+% In the docs, we should tell the users that the page environment is, in fact,
+% a tikzpicture - so they can use nodes etc inside it. Maybe we should
+% specify a relative unit for the x axis also? yes, we do now. we also shift
+% the scope, so that the origin is always at the bottom left of the source page.
+% we also need to add to the docs that the leftnotes env can stay - you don't
+% need to remove it when you set twocolumn to false.
+
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{pdfreview}[2017/09/22 v1.10]
+\ProvidesPackage{pdfreview}[2019/02/22 v1.20]
\RequirePackage{
adjustbox,
calc,
environ,
etoolbox,
+ fp,
graphicx,
- ifthen,
kvoptions,
tikz,
+ twoopt,
xstring
}
-\usetikzlibrary{calc}
+\usetikzlibrary{calc,arrows,positioning}
% improve file name handling
\RequirePackage[extendedchars,space]{grffile}
@@ -35,20 +54,23 @@
\DeclareBoolOption[false]{notenumbers}
\DeclareBoolOption[true]{inline}
\DeclareBoolOption[false]{withnotesonly}
+\DeclareBoolOption[false]{staggered}
%
+\DeclareStringOption[1]{scaletopage}
\DeclareStringOption[black!30]{gridcolor}
\DeclareStringOption[0.75]{bodywidth}
-\DeclareStringOption[1cm]{trim}
+\DeclareStringOption[{1cm 1cm 1cm 1cm}]{trim}
+\DeclareStringOption[0cm]{trimshift}
\DeclareStringOption[0.5pt]{bodyframe}
\DeclareStringOption[noname]{sourcedoc}
\DeclareStringOption[0]{pageoffset}
\DeclareStringOption[c]{alignnotes}
\DeclareStringOption[yellow]{notesbg}
+\DeclareStringOption[red]{important}
\DeclareStringOption[black]{notesframe}
\DeclareStringOption[3pt]{notesep}
\DeclareStringOption[footnotesize]{fontsize}
\DeclareStringOption[100]{maxscale}
-\DeclareStringOption[1]{stretch}
\DeclareStringOption[2.5cm]{insertpagemargin}
\ProcessKeyvalOptions*
@@ -57,13 +79,17 @@
% count spaces
\StrCount{\prv@trim}{ }[\prv@trimspaces]
-\ifthenelse{\equal{\prv@trimspaces}{0}}%
+\typeout{trim option: \prv@trim}
+\typeout{trim spaces: \prv@trimspaces}
+
+% \ifstrequal from etoolbox doesn't work here
+\IfEq{\prv@trimspaces}{0}%
% no spaces - trim all four sides the same
{\edef\prv@trimleft{\prv@trim}%
\edef\prv@trimright{\prv@trim}%
\edef\prv@trimtop{\prv@trim}%
\edef\prv@trimbottom{\prv@trim}%
- }{\ifthenelse{\equal{\prv@trimspaces}{1}}%
+ }{\IfEq{\prv@trimspaces}{1}%
% one space - apply separate trimming to h and v
{\StrCut{\prv@trim}{ }{\prv@trimh}{\prv@trimv}%
\edef\prv@trimleft{\prv@trimh}%
@@ -75,15 +101,30 @@
\StrCut{\prv@trimtwo}{ }{\prv@trimbottom}{\prv@trimthree}%
\StrCut{\prv@trimthree}{ }{\prv@trimright}{\prv@trimtop}}}
+\newcommand{\resettrim}[1][0pt]{% may be needed for figure pages
+ \edef\prv@trimleft{#1}%
+ \edef\prv@trimright{#1}%
+ \edef\prv@trimtop{#1}%
+ \edef\prv@trimbottom{#1}%
+}
+
\newcommand{\sourcedoc}{\prv@sourcedoc}
% control the split between the included page and the notes pane
\newlength{\prv@noteswidth}
\newlength{\prv@sourcebodywidth}
\newlength{\prv@bodyoffset}
-\newlength{\prv@rightnotesoffset}
+\newlength{\prv@notesxoffset}
\newlength{\prv@bodypadding}
+% a length for keeping track of bottom of the last note,
+% to guard against vertical overlap
+\newlength{\prv@currentnotebottom}
+\newlength{\prv@requestedbottom}
+\newlength{\prv@workingbottom}
+\newlength{\prv@notesboxheight}
+\newcommand{\prv@anchor}{west}
+
% empty space between body and notes
\setlength{\prv@bodypadding}{\prv@notesep}
@@ -102,24 +143,35 @@
\setlength{\prv@helpnumwidth}{\widthof{\prv@notesfont$\prv@maxscale$}+2\prv@xsep}
\RequirePackage[hidelinks]{hyperref}
+\hypersetup{pdfcreator={LaTeX with the pdfreview package}}
\RequirePackage{bookmark}
\newlength{\prv@notestextwidth}
\newlength{\prv@pageheight}
\newlength{\prv@unitheight}
+\newlength{\prv@unitwidth}
+
\newlength{\prv@currentheight}
\newsavebox{\prv@pagebox}
\newsavebox{\prv@gridboxright}
\newsavebox{\prv@gridboxleft}
+% global setlength - from https://tex.stackexchange.com/questions/406015/
+\gdef\gsetlength#1#2{%
+ \begingroup
+ \setlength\skip@{#2}
+ \global#1=\skip@
+ \endgroup
+}
+
\tikzset{
- notesfont/.style={
+ notesfont/.style={ % used for both notes and help line numbers
font=\prv@notesfont
},
%
- notes/.style={
- notesfont,
+ sticky/.style={ % set font and graphics, but not size or anchor
+ notesfont, % operation will shift the whole page up.
draw=\prv@notesframe,
fill=\prv@notesbg,
rounded corners=0.5pt,
@@ -127,8 +179,33 @@
inner ysep=0.4\ht\prv@charbox,
outer ysep=0.5pt,
outer xsep=0pt,
+ },
+ %
+ notes/.style={
+ sticky,
+ anchor=south west,% 't has to be this way, otherwise, the sbox
text width=\prv@notestextwidth,
- text height=\ht\prv@charbox
+ text height=\ht\prv@charbox,
+ alias=NN,
+ append after command={
+ \pgfextra{ % calculate and globally save node height
+ % simplified for height only, from Alain Matthes answer
+ % to https://tex.stackexchange.com/questions/38473/
+ % the reason for this is that within tikzpicture the
+ % \ht operator doesn't work on saveboxes for some reason.
+ % so we are forced to extract the height from the node.
+ \coordinate (A) at (NN.south);
+ \coordinate (B) at (NN.north);
+ \pgfpointdiff{\pgfpointanchor{A}{center}}%
+ {\pgfpointanchor{B}{center}}%
+ \pgfmathsetlength{\global\prv@notesboxheight}{\pgf@y}
+ }
+ }
+ },
+ %
+ important/.style={
+ notes,
+ draw=\prv@important
},
%
helpnum/.style={
@@ -159,11 +236,13 @@
},
%
hypertarget/.style={
- notes,
+ draw=none,
+ inner sep=0pt,
+ outer sep=0pt,
alias=targetnode,
append after command={
- let \p1=(targetnode.north west) in
- node[draw=none,at=(\p1)] {\hypertarget{#1}{}}
+ node[draw=none,above of=targetnode,yshift=\prv@notesboxheight]
+ {\hypertarget{#1}{}}
}
},
%
@@ -178,18 +257,18 @@
node [inner sep=0pt, outer sep=0pt,anchor=north west,at=(\p1)]
{\hyperlink{#1}{\phantom{\rule{\n1}{\n2}}}}
}
- }
+ },
}
\newcommand{\prv@drawgridboxright}{%
- \ifthenelse{\ht\prv@gridboxright<10}{%
+ \ifnumless{\ht\prv@gridboxright}{10}{%
\global\sbox{\prv@gridboxright}{%
\begin{tikzpicture}[y=\prv@unitheight,grid]%
\foreach \y in {0, 4, ..., \prv@maxscale}{%
\begin{scope}[yshift=\y\prv@unitheight]%
\draw (0,0) -- ++(\prv@noteswidth-\prv@helpnumwidth,0) node[helpnum,anchor=west]{$\y$};
- \ifthenelse{\equal{\y}{\prv@maxscale}}{}{%
- \foreach \z/\w in {1/0.25,2/0.5,3/0.25}{%
+ \ifnumequal{\y}{\prv@maxscale}{}{%
+ \foreach \z/\w in {1/1,2/2.5,3/1}{%
\draw (0,\z) -- ++(\w,0);
}}%
\end{scope}
@@ -199,15 +278,14 @@
}
\newcommand{\prv@drawgridboxleft}{%
- \ifthenelse{\ht\prv@gridboxleft<10}{%
+ \ifnumless{\ht\prv@gridboxleft}{10}{%
\global\sbox{\prv@gridboxleft}{%
\begin{tikzpicture}[y=\prv@unitheight,grid,xscale=-1]%
- %\draw[blue](0,0) rectangle (\prv@noteswidth,\prv@pageheight);
\foreach \y in {0, 4, ..., \prv@maxscale}{%
\begin{scope}[yshift=\y\prv@unitheight]%
\draw (0,0) -- ++(\prv@noteswidth-\prv@helpnumwidth,0) node[helpnum,anchor=east]{$\y$};
- \ifthenelse{\equal{\y}{\prv@maxscale}}{}{%
- \foreach \z/\w in {1/0.25,2/0.5,3/0.25}{%
+ \ifnumequal{\y}{\prv@maxscale}{}{%
+ \foreach \z/\w in {1/1,2/2.5,3/1}{%
\draw (0,\z) -- ++(\w,0);
}}%
\end{scope}
@@ -223,16 +301,67 @@
\newbool{prv@isempty}
\setbool{prv@isempty}{true}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
+% boolean that is set if code executes inside page environment
+\newbool{prv@inpage}
+\setbool{prv@inpage}{false}
+
+% flag for noteslist
+\newbool{prv@noteslistempty}
+\setbool{prv@noteslistempty}{true}
\newsavebox{\prv@wrapper}
+\newlength{\prv@leftshifted}
+\newlength{\prv@rightshifted}
+
+% flag for initial scaling - we scale dimensions to the first included page
+\newbool{prv@initialscaling}
+\setbool{prv@initialscaling}{false}
+
+\newcommand{\prv@scaledo}{%
+ \gsetlength{\prv@sourcebodywidth}{\prv@bodywidth\textwidth}%
+ \ifprv@twocolumn%
+ \gsetlength{\prv@noteswidth}{0.5\textwidth-0.5\prv@sourcebodywidth-\prv@bodypadding}%
+ \gsetlength{\prv@bodyoffset}{\prv@noteswidth+\prv@bodypadding-\prv@bodyframe}%
+ \else%
+ \gsetlength{\prv@noteswidth}{\textwidth-\prv@sourcebodywidth-\prv@bodypadding}%
+ \gsetlength{\prv@bodyoffset}{0pt}%
+ \fi%
+ % the x offset for the notes is a bit surprising, because the effective
+ % offset gets altered by the savebox mechanism. This value applies to
+ % the notes in the right margin; for the left margin, we override it locally
+ % in the leftnotes environment.
+ \gsetlength{\prv@notesxoffset}{\textwidth-\prv@noteswidth}%
+ \gsetlength{\prv@notestextwidth}{\prv@noteswidth-\prv@helpnumwidth-2\prv@xsep}%
+ \sbox{\prv@pagebox}{%
+ {\setlength{\fboxsep}{0pt}%
+ \adjustbox{clip,trim=\prv@trimleft{} \prv@trimbottom{} \prv@trimright{} \prv@trimtop{},%
+ width=\prv@sourcebodywidth,fbox=\prv@bodyframe}%
+ {\includegraphics[page=\prv@scaletopage]%
+ {\sourcedoc}}%
+ }}%
+ \gsetlength{\prv@pageheight}{\ht\prv@pagebox}%
+ \gsetlength{\prv@unitheight}{\prv@pageheight/\prv@maxscale}%
+ \gsetlength{\prv@unitwidth}{\prv@sourcebodywidth/\prv@maxscale}%
+ \global\setbool{prv@initialscaling}{true}
+}
+
\NewEnviron{page}[2][]{%
-% now, start the actual page content. we use a minipage for vertical centering
-%
+\ifbool{prv@initialscaling}%
+ {}%
+ {\prv@scaledo}% use first page to scale internal length parameters
\clearpage%
+% first, lets adjust the horizontal shifting
+\ifnumodd{#2}%
+ {\setlength{\prv@leftshifted}{\prv@trimleft+\prv@trimshift}%
+ \setlength{\prv@rightshifted}{\prv@trimright-\prv@trimshift}}
+ {\setlength{\prv@leftshifted}{\prv@trimleft-\prv@trimshift}%
+ \setlength{\prv@rightshifted}{\prv@trimright+\prv@trimshift}}
+
+%\setlength{\prv@currentnotebottom}{\prv@pageheight}%
+\pgfmathsetlength{\global\prv@currentnotebottom}{\prv@pageheight}%
\setcounter{prv@offsetpage}{#2+\prv@pageoffset}%
-\ifthenelse{\value{prv@offsetpage}<1}%
+\ifnumless{\value{prv@offsetpage}}{1}%
{\renewcommand*{\prv@pagelabel}{\roman{page}}}%
{\renewcommand*{\prv@pagelabel}{\arabic{prv@offsetpage}}}%
\ifbool{prv@withnotesonly}{}%
@@ -242,7 +371,7 @@
\noindent\begin{minipage}[c][\textheight]{\textwidth}%
\noindent\begin{center}%
\begin{adjustbox}{width=\textwidth}%
-\begin{tikzpicture}[y=\prv@unitheight]%
+\begin{tikzpicture}[x=\prv@unitwidth,y=\prv@unitheight,node distance=3pt]%
\ifprv@twocolumn
\ifprv@grid
\node[boxnode] at (0,0){\prv@drawgridboxleft};
@@ -258,81 +387,139 @@
\begin{scope}
\setlength{\fboxsep}{0pt}
\node[boxnode] at (\prv@bodyoffset,0)
- {\adjustbox{clip, trim=\prv@trimleft{} \prv@trimbottom{} \prv@trimright{} \prv@trimtop{},%
+ {\adjustbox{clip, trim=\prv@leftshifted{} \prv@trimbottom{} \prv@rightshifted{} \prv@trimtop{},%
#1,width=\prv@sourcebodywidth,fbox=\prv@bodyframe}%
- {\includegraphics[page=#2]{\sourcedoc}}};%
+ {\includegraphics[page=#2]{\sourcedoc}%
+ }};%
\end{scope}
-\begin{scope}[xshift=\prv@rightnotesoffset]%
-%}%
+% create a scope that overlays with the source page, in both
+% one- and two-column mode
+\begin{scope}[xshift=\prv@bodyoffset]
%
+\global\setbool{prv@inpage}{true}
\BODY
-%{
-\end{scope}\end{tikzpicture}%
+\global\setbool{prv@inpage}{false}
+%
+\end{scope}
+\end{tikzpicture}%
\end{adjustbox}%
\end{center}%
\end{minipage}%
\end{lrbox}
-%\ifbool{prv@isempty}%
+%
\ifboolexpr{bool {prv@isempty} and bool {prv@withnotesonly}}%
{\global\deadcycles=0}%
{\noindent\usebox{\prv@wrapper}}%
\global\setbool{prv@isempty}{true}\ignorespaces
}
-\newenvironment{leftnotes}%
-{\ifprv@twocolumn
- \begin{scope}[xshift=\prv@helpnumwidth-\prv@rightnotesoffset]%
- \else%
- \begin{scope}
- \fi}
+\newenvironment{leftnotes}% locally override the xoffset for the notes.
+{\ifprv@twocolumn%
+ \setlength{\prv@notesxoffset}{\prv@helpnumwidth}%
+\fi%
+% allow notes to start from the top again in staggered mode
+ % simple \setlength fails here, but \pgfmathsetlength works
+\pgfmathsetlength{\global\prv@currentnotebottom}{\prv@pageheight}}
%
-{\end{scope}}
+{\pgfmathsetlength{\global\prv@currentnotebottom}{\prv@pageheight}}
-% a no-op environment for the bureaucratically inclined
+% a matching no-op environment for the bureaucratically inclined
\newenvironment{rightnotes}{}{}
% use an insertpage environment for putting out the list of notes if requested
-\newcommand{\prv@noteslist}{\begin{insertpage}[List of notes]\begin{enumerate}}
+\newcommand{\prv@noteslist}{\begin{listofnotes}\begin{enumerate}}
-\newcommand{\prv@notealignment}{north west}
\newcounter{note}
+\newsavebox{\prv@notesbox}
-\newcommand{\note}[3][\prv@alignnotes]{%
-\ifbool{prv@isempty}%
- {%
- \ifbool{prv@withnotesonly}%
- {\phantomsection%
- \bookmark[level=1,page=\arabic{page}]{p. \prv@pagelabel}}{}%
- \global\setbool{prv@isempty}{false}%
- }%
- {}%
-\stepcounter{note}%
-\ifthenelse{\equal{#1}{b}}{\renewcommand{\prv@notealignment}{south west}}{%
- \ifthenelse{\equal{#1}{t}}{\renewcommand{\prv@notealignment}{north west}}{%
- \renewcommand{\prv@notealignment}{west}}}
-%
-\ifprv@inline
- \node[anchor=\prv@notealignment,hypertarget=note\arabic{note}] at (0,#2){%
- \bookmark[level=2,dest=note\arabic{note}]{Note \arabic{note}}%
- \raggedright\setlength{\parindent}{1em}\noindent%
- \ifprv@notenumbers\arabic{note})\ \fi%
- #3
- };
-\else
- \node[anchor=\prv@notealignment,hypertarget=note\arabic{note},%
- hyperlink=noteitem\arabic{note}] at (0,#2){%
- \bookmark[level=2,dest=note\arabic{note}]{Note \arabic{note}}%
- \raggedright\setlength{\parindent}{1em}\noindent%
- \g@addto@macro\prv@noteslist{\item \hypertarget{noteitem\arabic{enumi}}{}{#3}%
- \hyperlink{note\arabic{enumi}}{~$\uparrow$}}%
- \arabic{note}.
- };
-\fi
-}%
+\newcommand{\prv@calcbottom}[2]{%
+ % calculate bottom y to place next note on
+ % arguments: requested y pos, alignment. All other variables are global
+ %
+ % scale requested bottom position to source page height
+ \FPdiv{\prv@bottomratio}{#1}{\prv@maxscale}%
+ \setlength{\prv@requestedbottom}{\prv@bottomratio\prv@pageheight}%
+ % correct requested bottom position for alignment
+ \ifstrequal{#2}{b}%
+ {}%
+ {\ifstrequal{#2}{c}%
+ {\addtolength{\prv@requestedbottom}{-0.5\prv@notesboxheight}}%
+ {\addtolength{\prv@requestedbottom}{-\prv@notesboxheight}}}%
+ % adjust actual position to avoid overlap where needed. It seems we need two
+ % steps, since pgf is needed to make it stick globally, but it doesn't take
+ % the \minof operator. Oooh the manifold joys of LaTeX.
+ \ifprv@staggered%
+ \setlength{\prv@workingbottom}{\prv@currentnotebottom-\prv@notesboxheight}
+ \gsetlength{\prv@currentnotebottom}%
+ {\minof{\prv@requestedbottom}{\prv@workingbottom}}
+ \else%
+ \gsetlength{\prv@currentnotebottom}{\prv@requestedbottom}%
+ \fi%
+}
-\newcommand{\cnote}[2]{\note[c]{#1}{#2}}
-\newcommand{\bnote}[2]{\note[b]{#1}{#2}}
-\newcommand{\tnote}[2]{\note[t]{#1}{#2}}
+% draw a grid of help lines over the source page. We don't
+% use this as a global option, and the optional argument
+% to the page environment is already taken; therefore, it
+% just goes into a user macro.
+\newcommandtwoopt{\pagegrid}[2][][10]{%
+ \foreach \x in {0,#2,...,100}{
+ \draw[very thin,\prv@gridcolor,#1](0,\x) -- (100,\x);
+ \draw[very thin,\prv@gridcolor,#1](\x,0) -- (\x,100);
+}}
+
+\newcommand{\prv@importantitem}{\bfseries}%
+
+\newcommandtwoopt{\note}[4][\prv@alignnotes][]{%
+\ifbool{prv@inpage}{%
+ \ifbool{prv@isempty}%
+ {%
+ \ifbool{prv@withnotesonly}%
+ {\phantomsection%
+ \bookmark[level=1,page=\arabic{page}]{p. \prv@pagelabel}}{}%
+ \global\setbool{prv@isempty}{false}%
+ }%
+ {}%
+ \stepcounter{note}%
+ %
+ \begin{scope}[xshift=-\prv@bodyoffset]
+ \ifprv@inline
+ \sbox\prv@notesbox{\node[notes,#2] {%
+ \vspace{-\baselineskip}\newline% hack to force enough height for tabulars
+ \raggedright\setlength{\parindent}{1em}\noindent%
+ \ifprv@notenumbers\arabic{note})\ \fi%
+ #4
+ };}
+ \prv@calcbottom{#3}{#1}
+ \node[hypertarget=note\arabic{note}] at (\prv@notesxoffset,\prv@currentnotebottom){%
+ \bookmark[level=2,dest=note\arabic{note}]{Note \arabic{note}}\usebox{\prv@notesbox}};
+ \else
+ \sbox\prv@notesbox{\node[notes,#2]{12345.};}
+ \prv@calcbottom{#3}{#1}
+ \node[hypertarget=note\arabic{note},hyperlink=noteitem\arabic{note}]
+ at (\prv@notesxoffset,\prv@currentnotebottom){%
+ \bookmark[level=2,dest=note\arabic{note}]{Note \arabic{note}}%
+ \raggedright\setlength{\parindent}{1em}\noindent%
+ \global\setbool{prv@noteslistempty}{false}
+ \IfSubStr{#2}{important}%
+ {\g@addto@macro\prv@noteslist{\item%
+ \hypertarget{noteitem\arabic{enumi}}{}{\prv@importantitem{}#4}%
+ \hyperlink{note\arabic{enumi}}{~$\uparrow$}}}%
+ {\g@addto@macro\prv@noteslist{\item%
+ \hypertarget{noteitem\arabic{enumi}}{}{#4}%
+ \hyperlink{note\arabic{enumi}}{~$\uparrow$}}}%
+ %
+ \arabic{note}.
+ };
+ \fi
+ \end{scope}}
+ {\PackageWarning{pdfreview}{Not typesetting note outside of page environment}}%
+}% end \note
+
+\newcommand{\cnote}[3][]{\note[c][#1]{#2}{#3}}
+\newcommand{\bnote}[3][]{\note[b][#1]{#2}{#3}}
+\newcommand{\tnote}[3][]{\note[t][#1]{#2}{#3}}
+
+\newcommandtwoopt{\remark}[3][100][c]{\note[#2]{#1}{#3}}
% provide for extra pages with text
\newenvironment{insertpage}[1][General comments]%{}{}%
@@ -343,34 +530,32 @@
%
{\clearpage\aftergroup\restoregeometry}
+% noteslist is like insertpage, except that we don't restore the geometry
+% this will keep the modified margins in place for other appendices like
+% bibliographies
+\newenvironment{listofnotes}%
+{\clearpage%
+\phantomsection\addcontentsline{toc}{section}{List of notes}%
+\newgeometry{margin=\prv@insertpagemargin}
+\section*{List of notes}}
+%
+{\clearpage}
+
\AtBeginDocument{% divide up the page. Use package geometry if not yet loaded by user.
\@ifpackageloaded{geometry}{}% use of both package options and \newgeometry is intentional.
{\RequirePackage[hmargin=0.25cm,vmargin=2.5cm]{geometry}%
\newgeometry{hmargin=0.25cm,vmargin=2.5cm}}%
- \setlength{\prv@sourcebodywidth}{\prv@bodywidth\textwidth}%
- \ifprv@twocolumn%
- \setlength{\prv@noteswidth}{0.5\textwidth-0.5\prv@sourcebodywidth-\prv@bodypadding}%
- \setlength{\prv@bodyoffset}{\prv@noteswidth+\prv@bodypadding-\prv@bodyframe}%
- \else%
- \setlength{\prv@noteswidth}{\textwidth-\prv@sourcebodywidth-\prv@bodypadding}%
- \setlength{\prv@bodyoffset}{0pt}%
- \fi%
- \setlength{\prv@rightnotesoffset}{\textwidth-\prv@noteswidth}%
- \setlength{\prv@notestextwidth}{\prv@noteswidth-\prv@helpnumwidth-2\prv@xsep}%
- \sbox{\prv@pagebox}{%
- {\setlength{\fboxsep}{0pt}%
- \adjustbox{clip,trim=\prv@trimleft{} \prv@trimbottom{} \prv@trimright{} \prv@trimtop{},%
- width=\prv@sourcebodywidth,fbox=\prv@bodyframe}{\includegraphics[page=1]{\sourcedoc}}%
- }}%
- \setlength{\prv@pageheight}{\ht\prv@pagebox}%
- \setlength{\prv@unitheight}{\prv@stretch\prv@pageheight/\prv@maxscale}%
}%
\AtEndDocument{%
\ifprv@inline% do nothing
\else% close the notes list and print it out
- \g@addto@macro\prv@noteslist{\end{enumerate}\end{insertpage}}
- \clearpage
- \prv@noteslist
-\fi} \ No newline at end of file
+ \ifbool{prv@noteslistempty}{}{%
+ \g@addto@macro\prv@noteslist{\end{enumerate}\end{listofnotes}}
+ \clearpage
+ \prv@noteslist
+ }
+\fi}
+
+\newcommand{\ssout}[1]{\,\textbf{#1}\,} \ No newline at end of file