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/placeat/placeat.sty77
1 files changed, 49 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/lualatex/placeat/placeat.sty b/Master/texmf-dist/tex/lualatex/placeat/placeat.sty
index a42edbb9373..ccb1ffdce11 100644
--- a/Master/texmf-dist/tex/lualatex/placeat/placeat.sty
+++ b/Master/texmf-dist/tex/lualatex/placeat/placeat.sty
@@ -8,12 +8,12 @@
%%
%% EXPERIMENTAL CODE
%%
-%% This package is copyright © 2014 Arno L. Trautmann. It may be distributed and/or
+%% This package is copyright © 2017 Arno L. Trautmann. It may be distributed and/or
%% modified under the conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version. This work has the LPPL mainten-
%% ance status ‘maintained’.
\ProvidesPackage{placeat}%
- [2014/04/18 v0.1a absolute content positioning]
+ [2017/08/19 v0.1d absolute content positioning]
\RequirePackage{luatexbase}
\RequirePackage{luacode}
\RequirePackage{atbegshi}
@@ -76,7 +76,7 @@
\expandafter\xdef\csname #8y\endcsname{\coy + \csname #1y\endcsname}
}
}
-\NewDocumentCommand\placeminipageat{d()O{10cm}m}{
+\NewDocumentCommand\placeminipageat{r()O{10cm}m}{
\gdef\widthofplaceat{#2}
\placeat(#1)
{\begin{minipage}{\widthofplaceat}{#3}\end{minipage}}
@@ -93,6 +93,7 @@
\def\secondof #1,#2X{#2}
\let\ifdrawgrid\iftrue
\luaexec{
+ arrowheadlength = 5
drawgrid = false
nr = 0
dacoord = {}
@@ -106,7 +107,7 @@
\AtBeginDocument{
\AtBeginShipout{%
\AtBeginShipoutUpperLeftForeground{%
- \ifdrawgrid\drawgrid\fi
+ \ifnum\drawgridnum = 1 \drawgrid\fi
\luaexec{%
for i = 1,nr do
tex.print(dacoord[i].."{\\csname command"..(i).."\\endcsname}")
@@ -120,9 +121,11 @@
\luatexlatelua{
pdf_print("q")
linewidth(gridlinewidth)
+ local factorh = tex.pageheight/gridnry/65536
+ local factorw = tex.pagewidth/gridnrx/65536
for i = 1,math.max(gridnrx,gridnry) do
- h = i*tex.pageheight/gridnry/65536
- w = i*tex.pagewidth/gridnrx/65536
+ h = i*factorh
+ w = i*factorw
move(0,-h) line(tex.pagewidth,-h) stroke()
move(w,0) line(w,-tex.pageheight) stroke()
end
@@ -133,7 +136,7 @@
\normalfont\fontsize{8}{10}\selectfont
\luaexec{
for i=1,math.max(gridnrx+offsetx,gridnry+offsety) do
- hfac = tex.pageheight/gridnry/65536 %% another empirical factor
+ hfac = tex.pageheight/gridnry/65536
wfac = tex.pagewidth/gridnrx/65536*1.005 %% another empirical factor
h = (i-1)*hfac
w = (i-1)*wfac
@@ -147,46 +150,64 @@
}
}
}
-\NewDocumentCommand\placelineat{ou{(}u{,}u{)(}u{,}u{)}}{
- \placeat{#3}{#4}{\ignorespaces\IfValueT{#1}{\color{#1}}%
- \luatexlatelua{placelineat(#3,-#4,#5,-#6)}
+\NewDocumentCommand\placelineat{or()r()}{
+ \placeat(#2){\ignorespaces\IfValueT{#1}{\color{#1}} % only to fix the color!
+ \luatexlatelua{placelineat(#2,#3)}
}
}
-\NewDocumentCommand\placearrowat{ou{(}u{,}u{)(}u{,}u{)}}{
- \placeat{#3}{#4}{\ignorespaces\IfValueT{#1}{\color{#1}}%
- \luatexlatelua{placearrowat(#3,-#4,#5,-#6)}
+\NewDocumentCommand\placearrowat{or()r()}{
+ \placeat(#2){\ignorespaces\IfValueT{#1}{\color{#1}}%
+ \luatexlatelua{placearrowat(#2,#3)}
}
}
-\NewDocumentCommand\placecircleat{ou{(}u{,}u{)}G{3}}{
- \placeat{#3}{#4}{\ignorespaces\IfValueT{#1}{\color{#1}}%
- \luatexlatelua{placecircleat(#5)}
+\NewDocumentCommand\placecircleat{or()D(){.3}}{
+ \placeat(#2){\ignorespaces\IfValueT{#1}{\color{#1}}%
+ \luatexlatelua{placecircleat(#3,1)}
}
}
-\NewDocumentCommand\placesquareat{ou{(}u{,}u{)}G{3}}{
- \placeat{#3}{#4}{\ignorespaces\IfValueT{#1}{\color{#1}}%
- \luatexlatelua{placesquareat(#5)}
+\NewDocumentCommand\placefilledcircleat{or()D(){.3}}{
+ \placeat(#2){\ignorespaces\IfValueT{#1}{\color{#1}}%
+ \luatexlatelua{placecircleat(#3,1,true)}
}
}
-\NewDocumentCommand\placerectangleat{ou{(}u{,}u{)(}u{,}u{)}}{
- \placeat{#3}{#4}{\ignorespaces\IfValueT{#1}{\color{#1}}%
- \luatexlatelua{placerectangleat(#3,-#4,#5,-#6)}
+\NewDocumentCommand\placesquareat{or()G{3}}{
+ \placeat(#2){\ignorespaces\IfValueT{#1}{\color{#1}}%
+ \luatexlatelua{placesquareat(#3)}
}
}
-\NewDocumentCommand\placefilledrectangleat{ou{(}u{,}u{)(}u{,}u{)}}{
- \placeat{#3}{#4}{\ignorespaces\IfValueT{#1}{\color{#1}}%
- \luatexlatelua{placefilledrectangleat(#3,-#4,#5,-#6)}
+\NewDocumentCommand\placecurveat{or()r()r()r()}{
+ \placeat(#2){\ignorespaces\IfValueT{#1}{\color{#1}}%
+ \luatexlatelua{placecurveat(#2,#3,#4,#5)}
+ }
+}
+\NewDocumentCommand\placerectangleat{O{black}r()d()}{
+ \placeat(#2){\ignorespaces\color{#1}%
+ \luatexlatelua{placerectangleat(#2,#3)}
+ }
+}
+\NewDocumentCommand\placefilledrectangleat{O{black}r()r()}{
+ \placeat(#2){\ignorespaces\color{#1}%
+ \luatexlatelua{placerectangleat(#2,#3,true)}
+ }
+}
+\NewDocumentCommand\placeroundedat{sO{black}r()D(){0.1}D<>{1.5}}{
+ \placeat(#3){\ignorespaces\color{#2}%
+ \IfBooleanTF{#1}{\luatexlatelua{placecircleat(#4,#5,true)}}%
+ {\luatexlatelua{placecircleat(#4,#5)}}
}
}
\ExplSyntaxOn
\keys_define:nn{placeat}{
alphanumgrid.code:n = \directlua{alphanumgrid = true},
- final.code:n = \luaexec{placeat_final = true} \let\ifdrawgrid\iffalse,
- drawgrid.code:n = \global\let\ifdrawgrid\iftrue,
+ arrowheadlength.code:n = \directlua{arrowheadlength=#1},
+ final.code:n = \luaexec{placeat_final = true} \gdef\drawgridnum{0},
+ drawgrid.code:n = \gdef\drawgridnum{1},
gridnumber.code:n = \directlua{gridnr = #1 gridnrx = gridnr~gridnry = gridnr},
gridnumberx.code:n = \directlua{gridnrx = #1},
gridnumbery.code:n = \directlua{gridnry = #1},
gridlinewidth.code:n = \directlua{gridlinewidth = #1},
- nogrid.code:n = \global\let\ifdrawgrid\iffalse,
+ linewidth.code:n = {\placeat(1,1){\luatexlatelua{linewidth(#1)}}}, %% FIXME: this is a very nasty hack to implement user's choice of linewidth!
+ nogrid.code:n = \gdef\drawgridnum{0},
numnumgrid.code:n = \directlua{alphanumgrid = false},
offsetx.code:n = \directlua{offsetx = #1},
offsety.code:n = \directlua{offsety = #1},