summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua59
-rw-r--r--Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty45
2 files changed, 78 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua b/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua
index 5ef9b8f03bc..1926597ab90 100644
--- a/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua
+++ b/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.lua
@@ -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>
-- ------------------------------------------------------------
--
-- This file may be distributed and/or modified under the
@@ -374,8 +374,7 @@ function luatodonotes.linePositionsNextPage()
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 @@ function luatodonotes.callbackOutputLinePositions(head)
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 @@ function luatodonotes.callbackOutputLinePositions(head)
{12, 110, 0}, -- n
{12, 123, 0} -- {
}
- t = token.create("@todonotes@pdflastypos")
- tokenlist[#tokenlist + 1] = t
- tokenlist[#tokenlist + 1] = {12, 125, 0}
- tokenlist[#tokenlist + 1] = {12, 123, 0}
+ local t = token.create("@todonotes@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 @@ end
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,11 +1781,16 @@ local function posPoLeaders(notes, rightSide, avoidLines)
-- 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
@@ -1870,7 +1897,7 @@ local function posPoLeaders(notes, rightSide, avoidLines)
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
diff --git a/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty b/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty
index 80d63967175..287a82183f2 100644
--- a/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty
+++ b/Master/texmf-dist/tex/lualatex/luatodonotes/luatodonotes.sty
@@ -8,7 +8,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>
%%
@@ -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@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%
+ \ifdefined\Gm@changelayout
+ \g@addto@macro{\Gm@changelayout}{\@todonotes@setAdditionalMargin}
+ \fi
}%
\fi%
+\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}%
+}
\newdimen\@todonotes@extractx
\newdimen\@todonotes@extracty
\newsavebox\@todonotes@heightcalcbox
@@ -315,6 +322,7 @@
\directlua{luatodonotes.setPositioningAlgo("\luatexluaescapestring{\@todonotes@positioning}")}
\directlua{luatodonotes.setSplittingAlgo("\luatexluaescapestring{\@todonotes@splitting}")}
\directlua{luatodonotes.setLeaderType("\luatexluaescapestring{\@todonotes@leadertype}")}
+\ifdefined\pdflastypos\else\let\pdflastypos\lastypos\fi
\def\@todonotes@pdflastypos{\the\pdflastypos}
\newcommand{\@todonotes@lineposition}[3]{%
\directlua{luatodonotes.linePositionsAddLine(#1,#2,#3)}%
@@ -336,6 +344,9 @@
\newcommand{\@todonotes@AtBeginShipoutUpperLeft}
{\AtBeginShipoutUpperLeft}
\fi
+\newcommand{\@todonotes@before@tikzpict}{\begingroup%
+ \ifdefined\tikzexternaldisable\tikzexternaldisable\fi}
+\newcommand{\@todonotes@after@tikzpict}{\endgroup}
\directlua{luatodonotes.initTodonotes()}
\soulregister{\ }{0}
\newlength{\todonotes@textmark@width}
@@ -366,6 +377,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%
@@ -394,7 +406,8 @@
-- (\@todonotes@nodeNamePrefix areaSE)
}
-- cycle;
- \end{tikzpicture}%
+ \end{tikzpicture}%
+ \@todonotes@after@tikzpict%
}}%
}%
\newcommand{\@todonotes@currentlinecolor}{}%
@@ -548,17 +561,21 @@
\@todonotes@areaselectedtrue%
\@todocommon{#1}{#2}%
\todonotes@textmark@highlight{#3}%
+ \@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}%
}%
\newcommand{\@todonotes@drawMarginNoteWithLine}{%
+ \@todonotes@before@tikzpict%
\begin{tikzpicture}[remember picture, overlay]%
\node [coordinate] (@todonotes@\arabic{@todonotes@numberoftodonotes} %
inText) {};%
\end{tikzpicture}%
+ \@todonotes@after@tikzpict%
\@todonotes@baselineskip=\baselineskip%
\@todonotes@normalbaselineskip=\normalbaselineskip%
\@todonotes@fontsize=\f@size pt%
@@ -607,7 +624,9 @@
\addcontentsline{tdo}{todo}{\@todonotes@caption}%
\fi}%
\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 %
@@ -615,13 +634,16 @@
\else%
{\noindent \@todonotes@sizecommand \@todonotes@text}%
\fi};%
- \end{tikzpicture}\par}%
+ \end{tikzpicture}%
+ \@todonotes@after@tikzpict%
+ \par}%
}%
\newcommand{\missingfigure}[2][]{%
\setkeys{todonotes}{#1}%
\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);
@@ -632,6 +654,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
\newcommand{\todototoc}
@@ -659,10 +682,12 @@
\directlua{luatodonotes.calcHeightsForNotes()}% has to be outside of tikzpicture
\raisebox{\voffset}{%
\hspace{-\hoffset}%
+ \@todonotes@before@tikzpict%
\begin{tikzpicture}[remember picture,overlay]
\directlua{luatodonotes.getInputCoordinatesForNotes()}
\directlua{luatodonotes.printNotes()}
\end{tikzpicture}%
+ \@todonotes@after@tikzpict%
}%
\directlua{luatodonotes.clearNotes()}%
\EndCatcodeRegime