summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tikzmark
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-04-09 22:39:32 +0000
committerKarl Berry <karl@freefriends.org>2016-04-09 22:39:32 +0000
commit8b226d155f21235b95e26816b004ea6d3642f339 (patch)
tree8bb2a9ddd917a837cbb494f77105df3ad338dbbc /Master/texmf-dist/source/latex/tikzmark
parent0ce59d52f60266fe99c400e353e27b3ede248097 (diff)
tikzmark (8apr16)
git-svn-id: svn://tug.org/texlive/trunk@40372 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tikzmark')
-rw-r--r--Master/texmf-dist/source/latex/tikzmark/tikzmark.dtx164
-rw-r--r--Master/texmf-dist/source/latex/tikzmark/tikzmark.ins13
2 files changed, 148 insertions, 29 deletions
diff --git a/Master/texmf-dist/source/latex/tikzmark/tikzmark.dtx b/Master/texmf-dist/source/latex/tikzmark/tikzmark.dtx
index b1f655659f4..411887f043f 100644
--- a/Master/texmf-dist/source/latex/tikzmark/tikzmark.dtx
+++ b/Master/texmf-dist/source/latex/tikzmark/tikzmark.dtx
@@ -5,7 +5,7 @@
%<*readme>
----------------------------------------------------------------
tikzmark --- remembering absolute positioning with TikZ
-E-mail: stacey@math.ntnu.no
+E-mail: loopspace@mathforge.org
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------
@@ -28,7 +28,7 @@ exclusively) with TikZ.
\preamble
----------------------------------------------------------------
tikzmark --- remembering absolute positioning with TikZ.
-E-mail: stacey@math.ntnu.no
+E-mail: loopspace@mathforge.org
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------
@@ -36,7 +36,7 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no>
+Copyright (C) 2011-2016 by Andrew Stacey <loopspace@mathforge.org>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -53,7 +53,6 @@ and the derived files tikzmark.ins,
tikzmark.pdf,
tikzlibrarytikzmark.code.tex, and
tikzmarklibrarylistings.code.tex
- tikzmarklibraryhighlight.code.tex
\endpostamble
\usedir{tex/latex/tikzmark}
@@ -84,10 +83,6 @@ and the derived files tikzmark.ins,
\expandafter\endgroup
\fi
%</internal>
-%<*package>
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tikzmark}[2012/10/24 v1.0 TikZmark]
-%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
@@ -190,7 +185,7 @@ and the derived files tikzmark.ins,
%</driver>
% \fi
%
-% \CheckSum{442}
+% \CheckSum{539}
%
% \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
@@ -210,13 +205,15 @@ and the derived files tikzmark.ins,
%
%
% \changes{1.0}{2012/11/08}{Converted to DTX file}
+% \changes{1.1}{2013/04/22}{Fix bug relating to active semi-colon}
+% \changes{1.2}{2016/04/07}{Tikzmark works inside tikzpicture, added easy suffix and prefix for tikzmarks}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \providecommand*{\url}{\texttt}
% \title{The \textsf{tikzmark} package}
-% \author{Andrew Stacey \\ \url{stacey@math.ntnu.no}}
-% \date{v1.0~from 2013/04/12}
+% \author{Andrew Stacey \\ \url{loopspace@mathforge.org}}
+% \date{v1.2~from 2016/04/07}
%
%
% \maketitle
@@ -271,7 +268,7 @@ and the derived files tikzmark.ins,
% \section{History}
%
% I wrote the original \Verb+\tikzmark+ macro in 2009 for use in lecture slides prepared with the \Verb+beamer+ package.
-% It's original definition was:
+% Its original definition was:
%
% \begin{lstlisting}
% \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
@@ -358,11 +355,24 @@ and the derived files tikzmark.ins,
% Sometimes this can be useful.
% Note, though, that if this is used to define an offset coordinate then this will only be available in the document \emph{after} the \Verb+\tikzmark+ command, even on later runs.
%
+% If the \Verb+beamer+ class is loaded then this command is made overlay-aware.
+%
+% \item \Verb+\tikzmark+\marg{name}\marg{coordinate}
+%
+% v1.2 of the \Verb+tikzmark+ package introduced a new variant of \Verb+\tikzmark+ which works inside a \Verb+tikzpicture+.
+% One feature of \Verb+\tikzmark+ which isn't part of TikZ's normal coordinate remembering system is the ability to use a \Verb+\tikzmark+ coordinate before it is defined (due to the use of the \Verb+aux+ file).
+% This is potentially useful to have inside a \Verb+tikzpicture+ and so it is now possible to use \Verb+\tikzmark+ inside a \Verb+tikzpicture+.
+% The syntax is slightly different as we need to specify the coordinates of a point to remember.
+%
+% This was inspired by the question \href{http://tex.stackexchange.com/q/295903/86}{Refer to a node in tikz that will be defined ``in the future'' (two passes)?} on TeX-SX.
+%
% \item \Verb+\pgfmark+\marg{name}
%
% This is a more basic form of the \Verb+\tikzmark+ which doesn't use any of the \Verb+\tikz+ overhead.
% One advantage of this command is that it doesn't create an \Verb+hbox+.
%
+% If the \Verb+beamer+ class is loaded then this command is made overlay-aware.
+%
% \item \Verb+\iftikzmark+\marg{name}\marg{true code}\marg{false code}
%
% This is a simple conditional to test if a particular mark is available.
@@ -390,6 +400,17 @@ and the derived files tikzmark.ins,
% Possible values are (by default) \Verb+above+, \Verb+below+, \Verb+left+, \Verb+right+, and \Verb+ignore+.
% (The last one sets the vector to the zero vector.)
%
+% \item \Verb+/tikz/tikzmark prefix=<prefix>+ and \Verb+/tikz/tikzmark suffix=<suffix>+
+%
+% These keys allow for the automatic addition of a prefix and/or suffix to each \Verb+\tikzmark+ name.
+% The prefix and suffix are added both at time of definition and of use, so providing one is in the same scope there is no difference in at the user level when using prefixes and suffixes.
+% What it can be useful for is to make the \Verb+\tikzmark+ names unique.
+% In particular, if the \Verb+beamer+ class is loaded then an automatic suffix is added corresponding to the overlay.
+% This means that if a slide consists of several overlays with \Verb+\tikzmark+s on them, and the positions of the \Verb+\tikzmark+s move then the resulting pictures should look right.
+% Without the automatic suffix, only the final positions of the marks would be used throughout.
+%
+% This was inspired by the question \href{http://tex.stackexchange.com/q/302517/86}{using tikzmark subnode with overlays beamer} on TeX-SX.
+%
% \item \Verb+\subnode[options]{name}{content}+
%
% This produces a pseudo-node named \Verb+name+ around the \Verb+content+.
@@ -451,6 +472,22 @@ and the derived files tikzmark.ins,
% \end{tikzpicture}
% \end{example}
%
+% An example using \Verb+\tikzmark+ inside a \Verb+tikzpicture+
+%
+% \begin{example}
+% \tikzset{tikzmark prefix=ex3-}
+% \begin{tikzpicture}[remember picture,overlay]
+% \draw[->,line width=1mm,cyan] (pic cs:a) to[bend left] (pic cs:b);
+% \end{tikzpicture}
+%
+% By placing the \tikzmark{a}code before the marks, the arrow goes under the subsequent text and picture.
+%
+% \begin{tikzpicture}
+% \filldraw[fill=gray] (0,0) circle[radius=1cm];
+% \tikzmark{b}{(-1,-1)}
+% \end{tikzpicture}
+% \end{example}
+%
% \subsection{Code Listings}
%
% If the \Verb+listings+ package has been loaded then issuing \Verb+\usetikzmarklibrary{listings}+ will load in some code to add marks to \Verb+lstlisting+ environments.
@@ -559,14 +596,14 @@ and the derived files tikzmark.ins,
% The positions are already recorded in the \Verb+aux+ file, all we really need to do is provide them with better names.
% \begin{macrocode}
save picture id/.code={%
- \immediate\write\pgfutil@auxout{%
- \string\savepointas{#1}{\pgfpictureid}}%
+ \protected@write\pgfutil@auxout{}{%
+ \string\savepointas{\tikzmark@pp@name{#1}}{\pgfpictureid}{0pt}{0pt}}%
},
% \end{macrocode}
% Provides a way to test if a picture has already been saved (in particular, can avoid errors on first runs)
% \begin{macrocode}
if picture id/.code args={#1#2#3}{%
- \@ifundefined{save@pt@#1}{%
+ \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{%
\pgfkeysalso{#3}%
}{
\pgfkeysalso{#2}%
@@ -592,14 +629,26 @@ and the derived files tikzmark.ins,
next page/ignore/.style={%
next page vector={\pgfqpoint{0pt}{0pt}}%
},
+% \end{macrocode}
+% Prefix and suffix for tikzmark names, shamelessly borrowed from the main tikz code
+% \begin{macrocode}
+ tikzmark prefix/.initial=,%
+ tikzmark suffix/.initial=,%
}
% \end{macrocode}
%
+% \begin{macro}{\tikzmark@pp@name}
+% \begin{macrocode}
+\def\tikzmark@pp@name#1{\csname pgfk@/tikz/tikzmark prefix\endcsname#1\csname pgfk@/tikz/tikzmark suffix\endcsname}%
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\savepointas}
% This is what gets written to the \Verb+aux+ file.
% \begin{macrocode}
-\def\savepointas#1#2{%
+\def\savepointas#1#2#3#4{%
\expandafter\gdef\csname save@pt@#1\endcsname{#2}%
+ \expandafter\gdef\csname save@pt@#1@offset\endcsname{\pgfqpoint{#3}{#4}}%
}
\def\savepicturepage#1#2{%
\expandafter\gdef\csname save@pg@#1\endcsname{#2}%
@@ -611,7 +660,7 @@ and the derived files tikzmark.ins,
% Auxiliary command for the coordinate system.
% \begin{macrocode}
\def\tmk@labeldef#1,#2\@nil{%
- \def\tmk@label{#1}%
+ \edef\tmk@label{\tikzmark@pp@name{#1}}%
\def\tmk@def{#2}%
}
% \end{macrocode}
@@ -640,6 +689,9 @@ and the derived files tikzmark.ins,
\advance\pgf@y by -\pgf@ya
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
+ \pgf@process{\pgfpointorigin\csname save@pt@\tmk@label @offset\endcsname}%
+ \advance\pgf@xa by \pgf@x
+ \advance\pgf@ya by \pgf@y
\@ifundefined{save@pg@\csname save@pt@\tmk@label\endcsname}{}{%
\@ifundefined{save@pg@\pgfpictureid}{}{%
\pgfkeysvalueof{/tikz/next page vector}%
@@ -651,16 +703,60 @@ and the derived files tikzmark.ins,
}%
\pgf@x=\pgf@xa
\pgf@y=\pgf@ya
+ \pgftransforminvert
+ \pgf@pos@transform{\pgf@x}{\pgf@y}%
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tikzmark}
+% Fix for bug reported in \href{http://tex.stackexchange.com/q/110014/86}{ Tikzmark and french seem to conflict}.
+%
+% First, the version for active semi-colon.
+% \begin{macrocode}
+\begingroup
+\catcode`\;=\active
+\gdef\tikzmark@active#1#2{%
+\tikz[remember picture with id=#2] #1;}
+\endgroup
+% \end{macrocode}
+% Now, the version for ordinary semi-colon.
% \begin{macrocode}
-\newcommand\tikzmark[2][]{%
+\def\tikzmark@nonactive#1#2{%
\tikz[remember picture with id=#2] #1;}
% \end{macrocode}
+% And the wrapper function for the above, which is when we're outside a tikzpicture environment
+% \begin{macrocode}
+\newcommand\tikzmark@outside[2][]{%
+ \ifnum\catcode`\;=\active
+ \let\tikzmark@next=\tikzmark@active
+ \else
+ \let\tikzmark@next=\tikzmark@nonactive
+ \fi
+ \tikzmark@next{#1}{#2}%
+}
+% \end{macrocode}
+% This is for when we're inside a tikzpicture environment
+% \begin{macrocode}
+\def\tikzmark@inside#1#2{%
+ \tikzset{remember picture}%
+ \tikz@scan@one@point\pgfutil@firstofone#2\relax
+ \protected@write\pgfutil@auxout{}{%
+ \string\savepointas{\tikzmark@pp@name{#1}}{\pgfpictureid}{\the\pgf@x pt}{\the\pgf@y pt}}%
+}
+% \end{macrocode}
+% And finally, the ultimate invoker:
+% \begin{macrocode}
+\def\tikzmark{%
+ \ifx\pgfpictureid\@undefined
+ \let\tikzmark@next=\tikzmark@outside
+ \else
+ \let\tikzmark@next=\tikzmark@inside
+ \fi
+ \tikzmark@next%
+}
+% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pgfmark}
@@ -674,13 +770,41 @@ and the derived files tikzmark.ins,
\noexpand\write\noexpand\pgfutil@auxout{%
\string\savepicturepage{\pgfpictureid}{\noexpand\thepage}}}%
\pgf@temp
- \immediate\write\pgfutil@auxout{%
- \string\savepointas{#1}{\pgfpictureid}}%
+ \protected@write\pgfutil@auxout{}{%
+ \string\savepointas{\tikzmark@pp@name{#1}}{\pgfpictureid}{0pt}{0pt}}%
\egroup
}
% \end{macrocode}
% \end{macro}
%
+%
+% If the beamer class is used, make the commands overlay aware.
+% \begin{macro}{\tikzmark<>}
+% \begin{macrocode}
+\@ifclassloaded{beamer}{
+ \renewcommand<>{\tikzmark}[2][]{\only#3{\beameroriginal{\tikzmark}[{#1}]{#2}}}
+}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pgfmark<>}
+% \begin{macrocode}
+\@ifclassloaded{beamer}{
+ \renewcommand<>{\pgfmark}[1]{\only#2{\beameroriginal{\pgfmark}{#1}}}
+}{}
+% \end{macrocode}
+% \end{macro}
+%
+% If beamer is loaded, add a suffix based on the frame number
+% \begin{macrocode}
+\@ifclassloaded{beamer}{
+ \tikzset{
+ tikzmark suffix=-\the\beamer@slideinframe
+ }
+}{}
+% \end{macrocode}
+%
+%
% \begin{macro}{\iftikzmark}
% \begin{macrocode}
\newcommand\iftikzmark[3]{%
diff --git a/Master/texmf-dist/source/latex/tikzmark/tikzmark.ins b/Master/texmf-dist/source/latex/tikzmark/tikzmark.ins
index 62635ed2cfd..c140222ca28 100644
--- a/Master/texmf-dist/source/latex/tikzmark/tikzmark.ins
+++ b/Master/texmf-dist/source/latex/tikzmark/tikzmark.ins
@@ -7,7 +7,7 @@
%% tikzmark.dtx (with options: `install')
%% ----------------------------------------------------------------
%% tikzmark --- remembering absolute positioning with TikZ.
-%% E-mail: stacey@math.ntnu.no
+%% E-mail: loopspace@mathforge.org
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
@@ -18,7 +18,7 @@
\preamble
----------------------------------------------------------------
tikzmark --- remembering absolute positioning with TikZ.
-E-mail: stacey@math.ntnu.no
+E-mail: loopspace@mathforge.org
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------
@@ -26,7 +26,7 @@ See http://www.latex-project.org/lppl.txt
\endpreamble
\postamble
-Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no>
+Copyright (C) 2011-2016 by Andrew Stacey <loopspace@mathforge.org>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
@@ -43,7 +43,6 @@ and the derived files tikzmark.ins,
tikzmark.pdf,
tikzlibrarytikzmark.code.tex, and
tikzmarklibrarylistings.code.tex
- tikzmarklibraryhighlight.code.tex
\endpostamble
\usedir{tex/latex/tikzmark}
@@ -53,12 +52,9 @@ and the derived files tikzmark.ins,
\generate{
\file{tikzmarklibrarylistings.code.tex}{\from{\jobname.dtx}{listings}}
}
-%\generate{
-% \file{tikzmarklibraryhighlight.code.tex}{\from{\jobname.dtx}{highlight}}
-%}
\endbatchfile
%%
-%% Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no>
+%% Copyright (C) 2011-2016 by Andrew Stacey <loopspace@mathforge.org>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
@@ -75,7 +71,6 @@ and the derived files tikzmark.ins,
%% tikzmark.pdf,
%% tikzlibrarytikzmark.code.tex, and
%% tikzmarklibrarylistings.code.tex
-%% tikzmarklibraryhighlight.code.tex
%%
%%
%% End of file `tikzmark.ins'.