texlive[53825] Master/texmf-dist: luatodonotes (17feb20)

commits+karl at tug.org commits+karl at tug.org
Mon Feb 17 23:18:23 CET 2020


Revision: 53825
          http://tug.org/svn/texlive?view=revision&revision=53825
Author:   karl
Date:     2020-02-17 23:18:23 +0100 (Mon, 17 Feb 2020)
Log Message:
-----------
luatodonotes (17feb20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/lualatex/luatodonotes/luatodonotes.pdf
    trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx
    trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins
    trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua
    trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty

Modified: trunk/Master/texmf-dist/doc/lualatex/luatodonotes/luatodonotes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx	2020-02-17 22:18:08 UTC (rev 53824)
+++ trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.dtx	2020-02-17 22:18:23 UTC (rev 53825)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2014-2017 by Fabian Lipp <fabian.lipp at gmx.de>
+% Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp at gmx.de>
 % based on the todonotes package
 %   by Henrik Skov Midtiby <henrikmidtiby at 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 at todonotes@additionalMarginEnabled}
 \@todonotes at 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 at todonotes@additionalMarginEnabled
     \newlength{\@todonotes at modpaperwidth}
     \AfterEndPreamble{%
-        \setlength{\@todonotes at modpaperwidth}{\paperwidth}%
-        \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
-        \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
-        \pdfpagewidth=\@todonotes at modpaperwidth%
-        \addtolength{\hoffset}{\@todonotes at additionalMargin}%
+        \@todonotes at setAdditionalMargin%
+%    \end{macrocode}
+% Additionally, if the |geometry| package is loaded we hook into
+% |\Gm at changelayout| to repeat this computation whenever |\newgeometry| is
+% called.
+%    \begin{macrocode}
+        \ifdefined\Gm at changelayout
+            \g at addto@macro{\Gm at changelayout}{\@todonotes at 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 at setAdditionalMargin}{
+    \setlength{\@todonotes at modpaperwidth}{\paperwidth}%
+    \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
+    \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
+    \ifdefined\pdfpagewidth\else\let\pdfpagewidth\pagewidth\fi
+    \pdfpagewidth=\@todonotes at modpaperwidth%
+    \addtolength{\hoffset}{\@todonotes at 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 at 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 at before@tikzpict}{\begingroup%
+    \ifdefined\tikzexternaldisable\tikzexternaldisable\fi}
+\newcommand{\@todonotes at 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 at numberoftodonotes}%
          @\arabic{@todonotes at numberofLinesInArea} }%
     \hspace*{\todonotes at textmark@shift}{\smash{%
+        \@todonotes at before@tikzpict%
         \begin{tikzpicture}[overlay,remember picture,
             deco/.style={}]%
             \setlength\todonotes at textmark@linebelow%
@@ -1560,7 +1599,8 @@
                     -- (\@todonotes at nodeNamePrefix areaSE)
                 }
                 -- cycle;
-         \end{tikzpicture}%
+        \end{tikzpicture}%
+        \@todonotes at 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 at before@tikzpict%
     \begin{tikzpicture}[remember picture, overlay]%
         \node [coordinate] (@todonotes@\arabic{@todonotes at numberoftodonotes} %
             inTextEnd) {};%
     \end{tikzpicture}%
+    \@todonotes at after@tikzpict%
     \zref at label{@todonotes@\arabic{@todonotes at 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 at before@tikzpict%
     \begin{tikzpicture}[remember picture, overlay]%
         \node [coordinate] (@todonotes@\arabic{@todonotes at numberoftodonotes} %
             inText) {};%
     \end{tikzpicture}%
+    \@todonotes at 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 at drawInlineNote}{%
-    {\par\noindent\begin{tikzpicture}[remember picture]%
+    {\par\noindent%
+        \@todonotes at before@tikzpict%
+        \begin{tikzpicture}[remember picture]%
         \draw node[@todonotes at inlinenote,font=\@todonotes at sizecommand]{%
             \if at todonotes@authorgiven%
                 {\noindent \@todonotes at sizecommand %
@@ -1945,7 +1991,9 @@
             \else%
                 {\noindent \@todonotes at sizecommand \@todonotes at text}%
             \fi};%
-        \end{tikzpicture}\par}%
+        \end{tikzpicture}%
+        \@todonotes at after@tikzpict%
+    \par}%
     }%
 %    \end{macrocode}
 % \end{macro}
@@ -1957,6 +2005,7 @@
 \addcontentsline{tdo}{todo}{\@todonotes at MissingFigureText: #2}%
 \par
 \noindent
+\@todonotes at before@tikzpict%
 \begin{tikzpicture}
 \draw[fill=\@todonotes at currentfigcolor, draw = black!40, line width=2pt]
     (-2, -2.5) rectangle +(\@todonotes at currentfigwidth, \@todonotes at currentfigheight);
@@ -1967,6 +2016,7 @@
 \draw (0, 0.3) node {\@todonotes at MissingFigureUp};
 \draw (0, -0.3) node {\@todonotes at MissingFigureDown};
 \end{tikzpicture}\hfill
+\@todonotes at after@tikzpict%
 }% Ending \missingfigure command
 \fi% Ending \@todonotes at ifdisabled
 %    \end{macrocode}
@@ -2054,6 +2104,7 @@
 %    \begin{macrocode}
         \raisebox{\voffset}{%
             \hspace{-\hoffset}%
+            \@todonotes at 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 at after@tikzpict%
         }%
 %    \end{macrocode}
 % Delete the drawn notes from the Lua lists and prepare for the next page.

Modified: trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins	2020-02-17 22:18:08 UTC (rev 53824)
+++ trunk/Master/texmf-dist/source/lualatex/luatodonotes/luatodonotes.ins	2020-02-17 22:18:23 UTC (rev 53825)
@@ -1,5 +1,5 @@
 %%
-%% Copyright (C) 2014-2015 by Fabian Lipp <fabian.lipp at gmx.de>
+%% Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp at gmx.de>
 %% based on the todonotes package by
 %%   Henrik Skov Midtiby <henrikmidtiby at gmail.com>
 %%
@@ -23,7 +23,7 @@
 
 This is a generated file.
 
-Copyright (C) 2014-2015 by Fabian Lipp <fabian.lipp at gmx.de>
+Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp at gmx.de>
 based on the todonotes package by
   Henrik Skov Midtiby <henrikmidtiby at gmail.com>
 

Modified: trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua	2020-02-17 22:18:08 UTC (rev 53824)
+++ trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua	2020-02-17 22:18:23 UTC (rev 53825)
@@ -1,5 +1,5 @@
 --
--- Copyright (C) 2014-2015 by Fabian Lipp <fabian.lipp at gmx.de>
+-- Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp at gmx.de>
 -- ------------------------------------------------------------
 -- 
 -- This file may be distributed and/or modified under the
@@ -374,8 +374,7 @@
 end
 
 function luatodonotes.linePositionsAddLine(ycoord, lineheight, linedepth)
-    local baseline = ycoord - tex.pageheight
-    linePositionsCurPage[#linePositionsCurPage + 1] = {baseline, baseline + lineheight, baseline - linedepth}
+    linePositionsCurPage[#linePositionsCurPage + 1] = {ycoord, lineheight, linedepth}
 end
 
 
@@ -741,7 +740,7 @@
                 end
 
                 if foundGlyph then
-                    local w = node.new("whatsit", "write") -- 8/1
+                    local w = node.new("whatsit", "write")
                     w.stream = lpoFileStream
                     local tokenlist = {
                         {12,  92, 0}, -- \
@@ -770,19 +769,31 @@
                         {12, 110, 0}, -- n
                         {12, 123, 0} -- {
                     }
-                    t = token.create("@todonotes at pdflastypos")
-                    tokenlist[#tokenlist + 1] = t
-                    tokenlist[#tokenlist + 1] = {12, 125, 0}
-                    tokenlist[#tokenlist + 1] = {12, 123, 0}
+                    local t = token.create("@todonotes at pdflastypos")
+                    -- the token handling changed with newer LuaTeX versions
+                    if tex.luatexversion > 81 then
+                        tokenlist[#tokenlist + 1] = {0, t.tok}
+                    else
+                        tokenlist[#tokenlist + 1] = t
+                    end
+                    tokenlist[#tokenlist + 1] = {12, 125, 0} -- }
+                    tokenlist[#tokenlist + 1] = {12, 123, 0} -- {
                     appendStrToTokenlist(tokenlist, tostring(head.height))
-                    tokenlist[#tokenlist + 1] = {12, 125, 0}
-                    tokenlist[#tokenlist + 1] = {12, 123, 0}
+                    tokenlist[#tokenlist + 1] = {12, 125, 0} -- }
+                    tokenlist[#tokenlist + 1] = {12, 123, 0} -- {
                     appendStrToTokenlist(tokenlist, tostring(head.depth))
-                    tokenlist[#tokenlist + 1] = {12, 125, 0}
+                    tokenlist[#tokenlist + 1] = {12, 125, 0} -- }
                     w.data = tokenlist
                     head.head = node.insert_before(head.head,head.head,w)
 
-                    local w = node.new("whatsit", "pdf_save_pos") -- 8/23
+                    -- the name of the whatsit node changed with newer LuaTeX versions
+                    local whatsitName
+                    if tex.luatexversion > 80 then
+                        whatsitName = "save_pos"
+                    else
+                        whatsitName = "pdf_save_pos"
+                    end
+                    local w = node.new("whatsit", whatsitName)
                     head.head = node.insert_before(head.head,head.head,w)
                 end
             end
@@ -1742,7 +1753,18 @@
 local function posPoLeaders(notes, rightSide, avoidLines)
     local linePositionsCurPage
     if avoidLines then
-        linePositionsCurPage = linePositions[currentPage] or {}
+        linePositionsCurPage = {}
+        -- use the current pageheight to convert coordinates:
+        -- savepos yields coordinates relativ to lower left corner of page,
+        -- while our tikzpicture is anchored at the upper left corner
+        for k, v in pairs(linePositions[currentPage] or {}) do
+            local baseline = v[1] - tex.pageheight
+            linePositionsCurPage[k] = {baseline, baseline + v[2], baseline - v[3]}
+            if todonotesDebug then
+                print("linePositionsAddLine, add: " .. v[1] .. ", pageheight: " .. tex.pageheight ..
+                    ", result: " .. baseline)
+            end
+        end
     end
 
     -- number of slots on the whole page
@@ -1759,12 +1781,17 @@
     -- sort notes by inputY
     table.sort(notes, compareNoteIndInputYDesc)
 
-    -- draw slots
+    -- draw slots and line positions
     if todonotesDebug then
         for i = 1,totalNumSlots+1 do
             local pos = area.top - (i-1) * rasterHeight
-            tex.print("\\draw[blue,dashed] (0," .. pos .. "sp) -- +(21cm,0);") 
+            tex.print("\\draw[blue,dashed] (0," .. pos .. "sp) -- +(21cm,0);")
         end
+        for ind, v in pairs(linePositionsCurPage) do
+            local pos = v[1]
+            tex.print("\\draw[red,dashed] (0," .. pos .. "sp) -- +(21cm,0);")
+            tex.print("\\node[red] at (1cm," .. pos .. "sp) {" .. ind .. "};")
+        end
     end
 
     -- initialise table opt for dynamic program
@@ -1870,7 +1897,7 @@
                                 if avoidLines then
                                     leaderArmR = labelTopR - noteInnerSep - r:getHeight() / 2 -- east anchor
 
-                                    -- find first line (from the top) which lower bound is below leaderArmR
+                                    -- find first line (from the top) whose lower bound is below leaderArmR
                                     local lineBelowInd
                                     for ind, v in pairs(linePositionsCurPage) do
                                         if v[3] <= leaderArmR then

Modified: trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty	2020-02-17 22:18:08 UTC (rev 53824)
+++ trunk/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty	2020-02-17 22:18:23 UTC (rev 53825)
@@ -8,7 +8,7 @@
 %% 
 %% This is a generated file.
 %% 
-%% Copyright (C) 2014-2015 by Fabian Lipp <fabian.lipp at gmx.de>
+%% Copyright (C) 2014-2020 by Fabian Lipp <fabian.lipp at gmx.de>
 %% based on the todonotes package by
 %%   Henrik Skov Midtiby <henrikmidtiby at gmail.com>
 %% 
@@ -24,7 +24,7 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{luatodonotes}
-    [2017/09/30 v0.4 luatodonotes source and documentation.]
+    [2020/02/16 v0.5 luatodonotes source and documentation.]
 
 \@ifpackageloaded{todonotes}{
   \PackageError{luatodonotes}{%
@@ -280,13 +280,20 @@
 \if at todonotes@additionalMarginEnabled
     \newlength{\@todonotes at modpaperwidth}
     \AfterEndPreamble{%
-        \setlength{\@todonotes at modpaperwidth}{\paperwidth}%
-        \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
-        \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
-        \pdfpagewidth=\@todonotes at modpaperwidth%
-        \addtolength{\hoffset}{\@todonotes at additionalMargin}%
+        \@todonotes at setAdditionalMargin%
+        \ifdefined\Gm at changelayout
+            \g at addto@macro{\Gm at changelayout}{\@todonotes at setAdditionalMargin}
+        \fi
     }%
 \fi%
+\newcommand{\@todonotes at setAdditionalMargin}{
+    \setlength{\@todonotes at modpaperwidth}{\paperwidth}%
+    \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
+    \addtolength{\@todonotes at modpaperwidth}{\@todonotes at additionalMargin}%
+    \ifdefined\pdfpagewidth\else\let\pdfpagewidth\pagewidth\fi
+    \pdfpagewidth=\@todonotes at modpaperwidth%
+    \addtolength{\hoffset}{\@todonotes at additionalMargin}%
+}
 \newdimen\@todonotes at extractx
 \newdimen\@todonotes at extracty
 \newsavebox\@todonotes at heightcalcbox
@@ -315,6 +322,7 @@
 \directlua{luatodonotes.setPositioningAlgo("\luatexluaescapestring{\@todonotes at positioning}")}
 \directlua{luatodonotes.setSplittingAlgo("\luatexluaescapestring{\@todonotes at splitting}")}
 \directlua{luatodonotes.setLeaderType("\luatexluaescapestring{\@todonotes at leadertype}")}
+\ifdefined\pdflastypos\else\let\pdflastypos\lastypos\fi
 \def\@todonotes at pdflastypos{\the\pdflastypos}
 \newcommand{\@todonotes at lineposition}[3]{%
     \directlua{luatodonotes.linePositionsAddLine(#1,#2,#3)}%
@@ -336,6 +344,9 @@
     \newcommand{\@todonotes at AtBeginShipoutUpperLeft}
         {\AtBeginShipoutUpperLeft}
 \fi
+\newcommand{\@todonotes at before@tikzpict}{\begingroup%
+    \ifdefined\tikzexternaldisable\tikzexternaldisable\fi}
+\newcommand{\@todonotes at after@tikzpict}{\endgroup}
 \directlua{luatodonotes.initTodonotes()}
 \soulregister{\ }{0}
 \newlength{\todonotes at textmark@width}
@@ -366,6 +377,7 @@
         {@todonotes@\arabic{@todonotes at numberoftodonotes}%
          @\arabic{@todonotes at numberofLinesInArea} }%
     \hspace*{\todonotes at textmark@shift}{\smash{%
+        \@todonotes at before@tikzpict%
         \begin{tikzpicture}[overlay,remember picture,
             deco/.style={}]%
             \setlength\todonotes at textmark@linebelow%
@@ -394,7 +406,8 @@
                     -- (\@todonotes at nodeNamePrefix areaSE)
                 }
                 -- cycle;
-         \end{tikzpicture}%
+        \end{tikzpicture}%
+        \@todonotes at after@tikzpict%
     }}%
 }%
 \newcommand{\@todonotes at currentlinecolor}{}%
@@ -548,17 +561,21 @@
     \@todonotes at areaselectedtrue%
     \@todocommon{#1}{#2}%
     \todonotes at textmark@highlight{#3}%
+    \@todonotes at before@tikzpict%
     \begin{tikzpicture}[remember picture, overlay]%
         \node [coordinate] (@todonotes@\arabic{@todonotes at numberoftodonotes} %
             inTextEnd) {};%
     \end{tikzpicture}%
+    \@todonotes at after@tikzpict%
     \zref at label{@todonotes@\arabic{@todonotes at numberoftodonotes}@end}%
 }%
 \newcommand{\@todonotes at drawMarginNoteWithLine}{%
+    \@todonotes at before@tikzpict%
     \begin{tikzpicture}[remember picture, overlay]%
         \node [coordinate] (@todonotes@\arabic{@todonotes at numberoftodonotes} %
             inText) {};%
     \end{tikzpicture}%
+    \@todonotes at after@tikzpict%
     \@todonotes at baselineskip=\baselineskip%
     \@todonotes at normalbaselineskip=\normalbaselineskip%
     \@todonotes at fontsize=\f at size pt%
@@ -607,7 +624,9 @@
         \addcontentsline{tdo}{todo}{\@todonotes at caption}%
     \fi}%
 \newcommand{\@todonotes at drawInlineNote}{%
-    {\par\noindent\begin{tikzpicture}[remember picture]%
+    {\par\noindent%
+        \@todonotes at before@tikzpict%
+        \begin{tikzpicture}[remember picture]%
         \draw node[@todonotes at inlinenote,font=\@todonotes at sizecommand]{%
             \if at todonotes@authorgiven%
                 {\noindent \@todonotes at sizecommand %
@@ -615,7 +634,9 @@
             \else%
                 {\noindent \@todonotes at sizecommand \@todonotes at text}%
             \fi};%
-        \end{tikzpicture}\par}%
+        \end{tikzpicture}%
+        \@todonotes at after@tikzpict%
+    \par}%
     }%
 \newcommand{\missingfigure}[2][]{%
 \setkeys{todonotes}{#1}%
@@ -622,6 +643,7 @@
 \addcontentsline{tdo}{todo}{\@todonotes at MissingFigureText: #2}%
 \par
 \noindent
+\@todonotes at before@tikzpict%
 \begin{tikzpicture}
 \draw[fill=\@todonotes at currentfigcolor, draw = black!40, line width=2pt]
     (-2, -2.5) rectangle +(\@todonotes at currentfigwidth, \@todonotes at currentfigheight);
@@ -632,6 +654,7 @@
 \draw (0, 0.3) node {\@todonotes at MissingFigureUp};
 \draw (0, -0.3) node {\@todonotes at MissingFigureDown};
 \end{tikzpicture}\hfill
+\@todonotes at after@tikzpict%
 }% Ending \missingfigure command
 \fi% Ending \@todonotes at ifdisabled
 \newcommand{\todototoc}
@@ -659,10 +682,12 @@
         \directlua{luatodonotes.calcHeightsForNotes()}% has to be outside of tikzpicture
         \raisebox{\voffset}{%
             \hspace{-\hoffset}%
+            \@todonotes at before@tikzpict%
             \begin{tikzpicture}[remember picture,overlay]
                 \directlua{luatodonotes.getInputCoordinatesForNotes()}
                 \directlua{luatodonotes.printNotes()}
             \end{tikzpicture}%
+            \@todonotes at after@tikzpict%
         }%
         \directlua{luatodonotes.clearNotes()}%
         \EndCatcodeRegime



More information about the tex-live-commits mailing list.