From e9f04505a09f012779b28101d16874ae45805679 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 16 Sep 2011 22:36:25 +0000 Subject: new tikz package tikzpagenodes (16sep11) git-svn-id: svn://tug.org/texlive/trunk@23984 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/tikzpagenodes/README | 21 ++ .../doc/latex/tikzpagenodes/tikzpagenodes.pdf | Bin 0 -> 141475 bytes .../source/latex/tikzpagenodes/tikzpagenodes.dtx | 253 +++++++++++++++++++++ .../source/latex/tikzpagenodes/tikzpagenodes.ins | 9 + .../tex/latex/tikzpagenodes/tikzpagenodes.sty | 49 ++++ 5 files changed, 332 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/tikzpagenodes/README create mode 100644 Master/texmf-dist/doc/latex/tikzpagenodes/tikzpagenodes.pdf create mode 100644 Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.dtx create mode 100644 Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.ins create mode 100644 Master/texmf-dist/tex/latex/tikzpagenodes/tikzpagenodes.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/tikzpagenodes/README b/Master/texmf-dist/doc/latex/tikzpagenodes/README new file mode 100644 index 00000000000..2f219ad7ea5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzpagenodes/README @@ -0,0 +1,21 @@ +LaTeX package 'tikzpagenodes' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Copyright (c) 2011 by Martin Scharrer +WWW: http://latex.scharrer.me/ +CTAN: http://www.ctan.org/pkg/tikzpagenodes +Code repository: https://bitbucket.org/martin_scharrer/tikzpagenodes + +This LaTeX package provides specials PGF/TikZ nodes for the text, marginpar, +footer and header area of the current page. They are inspired by the special +'current page' node defined by PGF/TikZ itself. + +The nodes are rectangular and have the following names: + + current page text area + current page marginpar area + current page header area + current page footer area + +In order to use these nodes a TikZ picture needs to use the 'remember picture' option +and be compiled twice. + diff --git a/Master/texmf-dist/doc/latex/tikzpagenodes/tikzpagenodes.pdf b/Master/texmf-dist/doc/latex/tikzpagenodes/tikzpagenodes.pdf new file mode 100644 index 00000000000..9650f2be588 Binary files /dev/null and b/Master/texmf-dist/doc/latex/tikzpagenodes/tikzpagenodes.pdf differ diff --git a/Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.dtx b/Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.dtx new file mode 100644 index 00000000000..94fd9b07c86 --- /dev/null +++ b/Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.dtx @@ -0,0 +1,253 @@ +% \iffalse meta-comment +% +% Copyright (C) 2011 by Martin Scharrer +% --------------------------------------------------------------------------- +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Martin Scharrer. +% +% This work consists of the files tikzpagenodes.dtx and tikzpagenodes.ins +% and the derived filebase tikzpagenodes.sty. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{tikzpagenodes.dtx}[2011/09/15 v1.0 DTX file for tikzpagenodes package] +\documentclass{ydoc} +\usepackage{tikzpagenodes} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{tikzpagenodes.dtx} + \PrintChanges + \PrintIndex +\end{document} +% +% \fi +% +% \CheckSum{188} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v1.0}{2011/09/15}{First version.} +% +% \DoNotIndex{\newcommand,\newenvironment} +% +% \providecommand*{\url}{\texttt} +% \GetFileInfo{tikzpagenodes.dtx} +% \title{The \textsf{tikzpagenodes} package} +% \author{Martin Scharrer\\ \url{martin@scharrer.me}} +% \makeatletter +% \def\@homepage{\url{http://www.ctan.org/pkg/tikzpagenodes}\\[\medskipamount]\url{https://bitbucket.org/martin_scharrer/tikzpagenodes}} +% \makeatother +% +% \maketitle +% \section{Introduction} +% The drawing bundle PGF/TikZ provides a special rectangle node \texttt{current page} which allows users to access all edges and the center of the current page. +% This is useful if material should be drawn or placed on absolute positions of the page. +% For this to work the \texttt{tikzpicture} need to use the \texttt{remember picture} option to remember its position relative to the page origin. +% +% Often material should also be drawn or placed relative to other areas of the page, e.g.\ the text area. +% Such a node can be defined manually as shown in the post \href{http://permalink.gmane.org/gmane.comp.tex.pgf.user/2078}{More special nodes} on the \texttt{pgf-users} list. +% This package was written to simplify this by providing real special nodes which are defined in the same way as \texttt{current page}. +% One difficulty is that in \texttt{twoside} mode odd and even pages have different margins. For this the author's other package \texttt{ifoddpage} is used. +% +% \section{Usage} +% The provided nodes can be used in all \env{tikzpicture}s which use the \texttt{remember picture} option. In the majority of the cases the option \texttt{overlay} should also be used +% to avoid that the picture reserves any space at the position its code is placed. +% +% The following special nodes are provided. They are rectangle in shape, possess all anchors of this shape: +% +% \par\medskip\par\noindent +% \begin{minipage}{\textwidth} +% \begin{tabular}{>{\ttfamily}ll} +% \toprule +% \normalfont Node & Description \\ +% \midrule +% current page text area & Text area\footnote{Up to the baseline of the text area, i.e.\ the depth of the last line is not included} \small(\Macro\textwidth\relax$\times$\Macro\textheight) \\ +% current page marginpar area & Marginpar area \small(\Macro\marginparwidth\relax$\times$\Macro\textheight) \\ +% current page header area & Header area \small(\Macro\textwidth\relax$\times$\Macro\headerheight) \\ +% current page footer area & Footer area \small(\Macro\textwidth\relax$\times$\Macro\headerheight +% \footnote{Officially there is no footer height. Its baseline has a distance of \Macro\footerskip from the baseline of the text area. +% Because using this value would make the upper edge equal to the lower edge of the text area node, the \Macro\headerheight is used as a decent replacement.}) \\ +% \bottomrule +% \end{tabular} +% \end{minipage} +% +% +% \clearpage +% \section{Examples} +% +% \begin{examplecode} +% \tikz[remember picture,overlay] {% +% \draw [blue,line width=2mm] +% (current page.south west) +% rectangle +% (current page.north east) +% ; +% \draw [green] +% (current page text area.south west) +% rectangle +% (current page text area.north east) +% ; +% \draw [yellow] +% (current page marginpar area.south west) +% rectangle +% (current page marginpar area.north east) +% ; +% \draw [red] +% (current page header area.south west) +% rectangle +% (current page header area.north east) +% ; +% \draw [orange] +% (current page footer area.south west) +% rectangle +% (current page footer area.north east) +% ; +% }% +% \end{examplecode} +% +% +% \StopEventually{} +% +% \clearpage +% \section{Implementation} +% +% \iffalse +%<*tikzpagenodes.sty> +% \fi +% \subsection{Package Header} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tikzpagenodes}[2011/09/15 v1.0 Special PGF/TikZ nodes for areas of the page] +% \end{macrocode} +% +% \begin{macrocode} +\RequirePackage{tikz} +\RequirePackage{ifoddpage} +% \end{macrocode} +% +% \subsection{Different margins for odd and even pages in \texttt{twoside} mode} +% +% Update the page conditional for every picture which uses \texttt{remember picture}. +% \begin{macrocode} +\tikzset{every picture/.append style={execute at begin picture={% + \ifpgfrememberpicturepositiononpage + \checkoddpage + \fi +}}} +% \end{macrocode} +% +% \begin{macro}{\currentsidemargin} +% Expands to the current left side margin, i.e. \Macro\oddsidemargin for odd pages in |twoside| mode and all pages in |oneside| mode +% or \Macro\evensidemargin for even pages in |twoside| mode. +% \begin{macrocode} +\def\currentsidemargin{\ifoddpageoroneside\oddsidemargin\else\evensidemargin\fi}% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Often used lengths} +% +% \begin{macro}{\current@textarea@left} +% Complete left margin including 1in constant and offset. This value is used multiple times and therefore stored in macro. +% \begin{macrocode} +\def\current@textarea@left{(1in+\hoffset+\currentsidemargin)} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\current@textarea@top} +% Complete top margin including 1in constant, offset and header. This value is used multiple times and therefore stored in macro. +% \begin{macrocode} +\def\current@textarea@top{(1in+\voffset+\topmargin+\headheight+\headsep)} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Current Page Text Area Node} +% \begin{macrocode} +\expandafter\def\csname pgf@sh@ns@current page text area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page text area\endcsname{% + \def\southwest{\pgfpoint{\current@textarea@left}{\paperheight-\current@textarea@top-\textheight}}% + \def\northeast{\pgfpoint{\current@textarea@left+\textwidth}{\paperheight-\current@textarea@top}}% +} +\expandafter\let\csname pgf@sh@nt@current page text area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page text area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +% \end{macrocode} +% +% +% \subsection{Current Page Marginpar Area Node} +% \begin{macrocode} +\expandafter\def\csname pgf@sh@ns@current page marginpar area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page marginpar area\endcsname{% + \def\southwest{\pgfpoint + {\current@textarea@left\ifoddpageoroneside+\textwidth+\marginparsep\else-\marginparsep\fi}% + {\paperheight-\current@textarea@top-\textheight}% + }% + \def\northeast{\pgfpoint + {\current@textarea@left\ifoddpageoroneside+\textwidth+\marginparsep+\marginparwidth\else-\marginparsep-\marginparwidth\fi}% + {\paperheight-\current@textarea@top}% + }% +} +\expandafter\let\csname pgf@sh@nt@current page marginpar area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page marginpar area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +% \end{macrocode} +% +% +% \subsection{Current Page Header Area Node} +% \begin{macrocode} +\expandafter\def\csname pgf@sh@ns@current page header area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page header area\endcsname{% + \def\southwest{\pgfpoint{\current@textarea@left}{\paperheight-\current@textarea@top+\headsep}}% + \def\northeast{\pgfpoint{\current@textarea@left+\textwidth}{\paperheight-\current@textarea@top+\headsep+\headheight}}% +} +\expandafter\let\csname pgf@sh@nt@current page header area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page header area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +% \end{macrocode} +% +% +% \subsection{Current Page Footer Area Node} +% \begin{macrocode} +\expandafter\def\csname pgf@sh@ns@current page footer area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page footer area\endcsname{% + \def\southwest{\pgfpoint{\current@textarea@left}{\paperheight-\current@textarea@top-\textheight-\footskip}}% + \def\northeast{\pgfpoint{\current@textarea@left+\textwidth}{\paperheight-\current@textarea@top-\textheight-\footskip+\headheight}}% +} +\expandafter\let\csname pgf@sh@nt@current page footer area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page footer area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.ins b/Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.ins new file mode 100644 index 00000000000..48da9378fdb --- /dev/null +++ b/Master/texmf-dist/source/latex/tikzpagenodes/tikzpagenodes.ins @@ -0,0 +1,9 @@ +% See file 'tikzpagenodes.dtx' for copyright and licence. +% +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\generate{% + \file{tikzpagenodes.sty}{\nopreamble\from{tikzpagenodes.dtx}{tikzpagenodes.sty}}% +} +\endbatchfile diff --git a/Master/texmf-dist/tex/latex/tikzpagenodes/tikzpagenodes.sty b/Master/texmf-dist/tex/latex/tikzpagenodes/tikzpagenodes.sty new file mode 100644 index 00000000000..781b6096ad5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikzpagenodes/tikzpagenodes.sty @@ -0,0 +1,49 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tikzpagenodes}[2011/09/15 v1.0 Special PGF/TikZ nodes for areas of the page] +\RequirePackage{tikz} +\RequirePackage{ifoddpage} +\tikzset{every picture/.append style={execute at begin picture={% + \ifpgfrememberpicturepositiononpage + \checkoddpage + \fi +}}} +\def\currentsidemargin{\ifoddpageoroneside\oddsidemargin\else\evensidemargin\fi}% +\def\current@textarea@left{(1in+\hoffset+\currentsidemargin)} +\def\current@textarea@top{(1in+\voffset+\topmargin+\headheight+\headsep)} +\expandafter\def\csname pgf@sh@ns@current page text area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page text area\endcsname{% + \def\southwest{\pgfpoint{\current@textarea@left}{\paperheight-\current@textarea@top-\textheight}}% + \def\northeast{\pgfpoint{\current@textarea@left+\textwidth}{\paperheight-\current@textarea@top}}% +} +\expandafter\let\csname pgf@sh@nt@current page text area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page text area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +\expandafter\def\csname pgf@sh@ns@current page marginpar area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page marginpar area\endcsname{% + \def\southwest{\pgfpoint + {\current@textarea@left\ifoddpageoroneside+\textwidth+\marginparsep\else-\marginparsep\fi}% + {\paperheight-\current@textarea@top-\textheight}% + }% + \def\northeast{\pgfpoint + {\current@textarea@left\ifoddpageoroneside+\textwidth+\marginparsep+\marginparwidth\else-\marginparsep-\marginparwidth\fi}% + {\paperheight-\current@textarea@top}% + }% +} +\expandafter\let\csname pgf@sh@nt@current page marginpar area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page marginpar area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +\expandafter\def\csname pgf@sh@ns@current page header area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page header area\endcsname{% + \def\southwest{\pgfpoint{\current@textarea@left}{\paperheight-\current@textarea@top+\headsep}}% + \def\northeast{\pgfpoint{\current@textarea@left+\textwidth}{\paperheight-\current@textarea@top+\headsep+\headheight}}% +} +\expandafter\let\csname pgf@sh@nt@current page header area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page header area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +\expandafter\def\csname pgf@sh@ns@current page footer area\endcsname{rectangle} +\expandafter\def\csname pgf@sh@np@current page footer area\endcsname{% + \def\southwest{\pgfpoint{\current@textarea@left}{\paperheight-\current@textarea@top-\textheight-\footskip}}% + \def\northeast{\pgfpoint{\current@textarea@left+\textwidth}{\paperheight-\current@textarea@top-\textheight-\footskip+\headheight}}% +} +\expandafter\let\csname pgf@sh@nt@current page footer area\expandafter\endcsname\csname pgf@sh@nt@current page\endcsname +\expandafter\let\csname pgf@sh@pi@current page footer area\expandafter\endcsname\csname pgf@sh@pi@current page\endcsname +\endinput +%% +%% End of file `tikzpagenodes.sty'. -- cgit v1.2.3