diff options
author | Karl Berry <karl@freefriends.org> | 2020-02-17 22:18:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-02-17 22:18:23 +0000 |
commit | ba5ea410b396b3df9584d93f2a9f1c20b7682d4b (patch) | |
tree | 6a1437d1c06946c23b07effb5a4bcb4310d70ff5 /Master/texmf-dist/source/lualatex | |
parent | aa619c5e702b29ead4e4bb7820e275bd0b056caf (diff) |
luatodonotes (17feb20)
git-svn-id: svn://tug.org/texlive/trunk@53825 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/lualatex')
-rw-r--r-- | Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx | 82 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins | 4 |
2 files changed, 69 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx b/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx index 2351cfbf6c3..1d634a6fc82 100644 --- a/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx +++ b/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2014-2017 by Fabian Lipp <fabian.lipp@gmx.de> +% Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp@gmx.de> % based on the todonotes package % by Henrik Skov Midtiby <henrikmidtiby@gmail.com> % ------------------------------------------------------------ @@ -24,7 +24,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{luatodonotes} %<*package> - [2017/09/30 v0.4 luatodonotes source and documentation.] + [2020/02/16 v0.5 luatodonotes source and documentation.] %</package> % %<*driver> @@ -32,7 +32,7 @@ \usepackage{wrapfig} \PassOptionsToPackage{colorlinks, urlcolor=blue}{hyperref} \usepackage{hypdoc} % this package loads hyperref among others -\usepackage[colorinlistoftodos, shadow]{luatodonotes}[2017/09/30] +\usepackage[colorinlistoftodos, shadow]{luatodonotes}[2020/02/16] \usepackage{fontspec} \usepackage{amsmath} \usepackage{setspace} @@ -51,7 +51,7 @@ %</driver> % \fi % -% \CheckSum{906} +% \CheckSum{951} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -742,7 +742,7 @@ % l.250 \directlua{require("luatodonotes")} % \end{verbatim} % This means that the file |luatodonotes.lua| cannot be found by Lua\TeX. -% It depends on the version of your \TeX{} installation. in which directories +% It depends on the version of your \TeX{} installation in which directories % Lua\TeX{} is looking for Lua source files. % You can query these paths with the following command: % \begin{verbatim} @@ -933,6 +933,12 @@ % placed in \texttt{\textbackslash caption}, e.g.)} % \changes{0.3}{2015/11/30}{Remove two variables from Lua global namespace} % \changes{0.3}{2015/12/02}{Less console output unless debug option is set} +% \changes{0.5}{2020/01/19}{Fixed bugs when using \texttt{poLeadersAvoidLines} +% as positioning algorithm in newer LuaTeX versions because some APIs have +% changed} +% \changes{0.5}{2020/01/20}{Bugfix: The line position calculation didn't use +% the current page height, which caused an offset on these positions in +% documents not using a4paper} % \end{environment} % % \subsection{Dependencies and definitions} @@ -1316,6 +1322,11 @@ % \changes{0.3}{2015/12/01}{Introduce package option \texttt{additionalMargin}} % \changes{0.4}{2016/04/01}{Fixed problems of the \texttt{additionalMargin} % option with certain documentclasses} +% \changes{0.5}{2017/11/21}{Make \texttt{additionalMargin} compatible with +% \texttt{\textbackslash newgeometry}} +% \changes{0.5}{2020/01/19}{Adapt to new LuaTeX versions, which provide command +% \texttt{\textbackslash pagewidth} instead of +% \texttt{\textbackslash pdfpagewidth} (but stay backwards compatible)} % \begin{macrocode} \newif{\if@todonotes@additionalMarginEnabled} \@todonotes@additionalMarginEnabledfalse @@ -1363,20 +1374,34 @@ \fi % \end{macrocode} % If the option |additionalMargin| is given, we enlarge the margins for the notes. -% We simply increase the page size by the doubled value of |additionalMargin| -% and move the contents to the right using |\hoffset|. % \begin{macrocode} \if@todonotes@additionalMarginEnabled \newlength{\@todonotes@modpaperwidth} \AfterEndPreamble{% - \setlength{\@todonotes@modpaperwidth}{\paperwidth}% - \addtolength{\@todonotes@modpaperwidth}{\@todonotes@additionalMargin}% - \addtolength{\@todonotes@modpaperwidth}{\@todonotes@additionalMargin}% - \pdfpagewidth=\@todonotes@modpaperwidth% - \addtolength{\hoffset}{\@todonotes@additionalMargin}% + \@todonotes@setAdditionalMargin% +% \end{macrocode} +% Additionally, if the |geometry| package is loaded we hook into +% |\Gm@changelayout| to repeat this computation whenever |\newgeometry| is +% called. +% \begin{macrocode} + \ifdefined\Gm@changelayout + \g@addto@macro{\Gm@changelayout}{\@todonotes@setAdditionalMargin} + \fi }% \fi% % \end{macrocode} +% We simply increase the page size by the doubled value of |additionalMargin| +% and move the contents to the right using |\hoffset|. +% \begin{macrocode} +\newcommand{\@todonotes@setAdditionalMargin}{ + \setlength{\@todonotes@modpaperwidth}{\paperwidth}% + \addtolength{\@todonotes@modpaperwidth}{\@todonotes@additionalMargin}% + \addtolength{\@todonotes@modpaperwidth}{\@todonotes@additionalMargin}% + \ifdefined\pdfpagewidth\else\let\pdfpagewidth\pagewidth\fi + \pdfpagewidth=\@todonotes@modpaperwidth% + \addtolength{\hoffset}{\@todonotes@additionalMargin}% +} +% \end{macrocode} % \subsection{Initialisation of our Lua code} % In this part we define some of the variables used by Lua depending on the % package options and do some other initialisation tasks. @@ -1456,6 +1481,7 @@ % We need this workaround because we cannot insert |\pdflastypos| directly into % the tokenlist in the Lua callback \texttt{callbackOutputLinePositions()}. % \begin{macrocode} +\ifdefined\pdflastypos\else\let\pdflastypos\lastypos\fi \def\@todonotes@pdflastypos{\the\pdflastypos} % \end{macrocode} % The following commands are written to the temporary \texttt{lpo}-file. @@ -1493,6 +1519,18 @@ {\AtBeginShipoutUpperLeft} \fi % \end{macrocode} +% Define commands that are used for every tikzpicture to disable +% externalization. +% We only call the |\tikzexternaldisable| command if it is defined (i.e., the +% externalization library for TikZ is loaded). +% Externalization is reenabled after the end of the group (if it was enabled +% before). +% \changes{0.5}{2018/04/08}{Disable TikZ externalization for our tikzpictures} +% \begin{macrocode} +\newcommand{\@todonotes@before@tikzpict}{\begingroup% + \ifdefined\tikzexternaldisable\tikzexternaldisable\fi} +\newcommand{\@todonotes@after@tikzpict}{\endgroup} +% \end{macrocode} % Initialise the script when all Lua variables are set according to the package % options. % \begin{macrocode} @@ -1532,6 +1570,7 @@ {@todonotes@\arabic{@todonotes@numberoftodonotes}% @\arabic{@todonotes@numberofLinesInArea} }% \hspace*{\todonotes@textmark@shift}{\smash{% + \@todonotes@before@tikzpict% \begin{tikzpicture}[overlay,remember picture, deco/.style={}]% \setlength\todonotes@textmark@linebelow% @@ -1560,7 +1599,8 @@ -- (\@todonotes@nodeNamePrefix areaSE) } -- cycle; - \end{tikzpicture}% + \end{tikzpicture}% + \@todonotes@after@tikzpict% }}% }% % \end{macrocode} @@ -1828,10 +1868,12 @@ % Mark the end of the highlighted area with a Tikz coordinate. % The begin is marked by |\@todocommon|. % \begin{macrocode} + \@todonotes@before@tikzpict% \begin{tikzpicture}[remember picture, overlay]% \node [coordinate] (@todonotes@\arabic{@todonotes@numberoftodonotes} % inTextEnd) {};% \end{tikzpicture}% + \@todonotes@after@tikzpict% \zref@label{@todonotes@\arabic{@todonotes@numberoftodonotes}@end}% }% % \end{macrocode} @@ -1846,10 +1888,12 @@ % First is the current location in the document stored, this enables % us later to connect this point with the inserted todonote. % \begin{macrocode} + \@todonotes@before@tikzpict% \begin{tikzpicture}[remember picture, overlay]% \node [coordinate] (@todonotes@\arabic{@todonotes@numberoftodonotes} % inText) {};% \end{tikzpicture}% + \@todonotes@after@tikzpict% % \end{macrocode} % Update the dimensions to be accessed by Lua. % \begin{macrocode} @@ -1937,7 +1981,9 @@ % Define helper function |drawInlineNote|. % \begin{macrocode} \newcommand{\@todonotes@drawInlineNote}{% - {\par\noindent\begin{tikzpicture}[remember picture]% + {\par\noindent% + \@todonotes@before@tikzpict% + \begin{tikzpicture}[remember picture]% \draw node[@todonotes@inlinenote,font=\@todonotes@sizecommand]{% \if@todonotes@authorgiven% {\noindent \@todonotes@sizecommand % @@ -1945,7 +1991,9 @@ \else% {\noindent \@todonotes@sizecommand \@todonotes@text}% \fi};% - \end{tikzpicture}\par}% + \end{tikzpicture}% + \@todonotes@after@tikzpict% + \par}% }% % \end{macrocode} % \end{macro} @@ -1957,6 +2005,7 @@ \addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: #2}% \par \noindent +\@todonotes@before@tikzpict% \begin{tikzpicture} \draw[fill=\@todonotes@currentfigcolor, draw = black!40, line width=2pt] (-2, -2.5) rectangle +(\@todonotes@currentfigwidth, \@todonotes@currentfigheight); @@ -1967,6 +2016,7 @@ \draw (0, 0.3) node {\@todonotes@MissingFigureUp}; \draw (0, -0.3) node {\@todonotes@MissingFigureDown}; \end{tikzpicture}\hfill +\@todonotes@after@tikzpict% }% Ending \missingfigure command \fi% Ending \@todonotes@ifdisabled % \end{macrocode} @@ -2054,6 +2104,7 @@ % \begin{macrocode} \raisebox{\voffset}{% \hspace{-\hoffset}% + \@todonotes@before@tikzpict% \begin{tikzpicture}[remember picture,overlay] % \end{macrocode} % Reads the absolute coordinates of every note on the page and writes them to @@ -2065,6 +2116,7 @@ % \begin{macrocode} \directlua{luatodonotes.printNotes()} \end{tikzpicture}% + \@todonotes@after@tikzpict% }% % \end{macrocode} % Delete the drawn notes from the Lua lists and prepare for the next page. diff --git a/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins b/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins index 1fc75094df2..bfaeb98a7e9 100644 --- a/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins +++ b/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2014-2015 by Fabian Lipp <fabian.lipp@gmx.de> +%% Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp@gmx.de> %% based on the todonotes package by %% Henrik Skov Midtiby <henrikmidtiby@gmail.com> %% @@ -23,7 +23,7 @@ This is a generated file. -Copyright (C) 2014-2015 by Fabian Lipp <fabian.lipp@gmx.de> +Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp@gmx.de> based on the todonotes package by Henrik Skov Midtiby <henrikmidtiby@gmail.com> |