diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-31 19:42:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-31 19:42:12 +0000 |
commit | 17077c45e5abbed7d2e4990baab2739aa2f4dcd5 (patch) | |
tree | dc3cdc03e506ff7e20278f24ec2fd6ced58945a6 /Master/texmf-dist | |
parent | 77742dcf233f4881b1cb58713324c2b54ad2e91f (diff) |
tikz-ext (31oct22)
git-svn-id: svn://tug.org/texlive/trunk@64877 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
11 files changed, 325 insertions, 10 deletions
diff --git a/Master/texmf-dist/doc/latex/tikz-ext/README.md b/Master/texmf-dist/doc/latex/tikz-ext/README.md index 76ea094357b..33ec46d366e 100644 --- a/Master/texmf-dist/doc/latex/tikz-ext/README.md +++ b/Master/texmf-dist/doc/latex/tikz-ext/README.md @@ -31,7 +31,6 @@ These are * `ext.shapes.heatmark` * `ext.shapes.rectangleroundedcorners` * `ext.shapes.superellipse` - * `ext.shapes.uncenteredrectangle` These were developed in response to questions on tex.stackexchange.com. Some of these can be find by searching for my [user id](https://tex.stackexchange.com/search?q=user%3A16595+%22my+library%22).
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-scalepicture.tex b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-scalepicture.tex new file mode 100644 index 00000000000..b14c4c4f0fb --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-scalepicture.tex @@ -0,0 +1,113 @@ +% !TeX spellcheck = en_US +% !TeX root = tikz-ext-manual.tex +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\clearpage +\section{Scaling Pictures to a Specific Size} +\label{library:scalepicture} + +\begin{tikzlibrary}{ext.scalepicture} + This library scales \tikzname\ pictures to a specific width or height + by scaling the whole picture. +\end{tikzlibrary} + +\begin{multicols}{2} +If one of the keys below are used on a \tikzname\ picture, i.\,e. +as an option to |\tikzpicture| or \texttt{\textbackslash begin\{tikzpicture\}} +the size of the picture\footnote{This is the size of the pseudo-node \texttt{current bounding box}.} +will be measured and written to the \filetype{aux} file +so that it will be available at the next compilation run +and an appropriate scaling for the picture can be installed. + +\begin{command}{\tikzextpicturewidth} + Returns the last measured width of the picture. + + This will expand to |0pt| if the picture hasn't been measured before. +\end{command} +\begin{command}{\tikzextpictureheight} + Returns the last measured height of the picture. + + This will expand to |0pt| if the picture hasn't been measured before. +\end{command} + +\begin{stylekey}{/tikz/save picture size} + This key is usually used by the keys provided by this library. + Normally, this is not needed to be explicitly given. +\end{stylekey} +\subsection{Keeping the aspect ratio} +The following \emph{unstarred} keys do not change the aspect ratio of the picture. + +\begin{key}{/tikz/picture width=\meta{dimension}} + Scales the picture so that the width of the picture will be \meta{dimension}. + This will keep the aspect ratio the same. +\end{key} + +\begin{key}{/tikz/minimum picture width=\meta{dimension}} + As above but will not change the size of the picture + if its width is greater than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/maximum picture width=\meta{dimension}} + As above but will not change the size of the picture + if its width is less than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/picture height=\meta{dimension}} + Scales the picture so that the height of the picture will be \meta{dimension}. + This will keep the aspect ratio the same. +\end{key} + +\begin{key}{/tikz/minimum picture height=\meta{dimension}} + As above but will not change the size of the picture + if its height is greater than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/maximum picture height=\meta{dimension}} + As above but will not change the size of the picture + if its height is less than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/minimum picture size=\marg{width}\marg{height}} + Scales the picture so that its height will be at least \meta{width} + and its height will be at least \meta{height}. +\end{key} + +\begin{key}{/tikz/maximum picture size=\marg{width}\marg{height}} + Scales the picture so that its height will be at most \meta{width} + and its height will be at most \meta{height}. +\end{key} + +\subsection{Changing the aspect ratio.} +The following \emph{starred} keys do change the aspect ratio. +\begin{key}{/tikz/picture width*=\meta{dimension}} + Scales the picture so that the width of the picture will be \meta{dimension}. + This will only scale the $x$ axis. +\end{key} + +\begin{key}{/tikz/minimum picture width*=\meta{dimension}} + As above but will not change the size of the picture + if its width is greater than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/maximum picture width*=\meta{dimension}} + As above but will not change the size of the picture + if its width is less than \meta{dimension}. +\end{key} + +\begin{key}{/tikz/picture height*=\meta{dimension}} + Scales the picture so that the height of the picture will be \meta{dimension}. + This will only scale the $y$ axis. +\end{key} + +\begin{key}{/tikz/picture size*=\marg{width}\marg{height}} + Scales the picture so that its width will be \meta{width} + and its height will be \meta{height}. + + This will scale both axes but independent from each other. +\end{key} +\end{multicols}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-body.tex b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-body.tex index 41e56c390ec..bf6620a2be8 100644 --- a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-body.tex +++ b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-body.tex @@ -8,7 +8,7 @@ % 2. under the GNU Free Documentation License. % \newcommand*\tikzextname{Ti\textit kZ-Extensions} -\newcommand*\tikzextversion{0.4.1} +\newcommand*\tikzextversion{0.4.2} \begin{document} {\colorlet{blue}{black}% links shall be black \title{\bfseries The \tikzextname\space Package\\ @@ -71,6 +71,8 @@ These libraries only work with \tikzname. \tikzsetfigurename{patterns.images} \include{tikz-ext-manual-en-library-patterns.images} \tikzsetfigurename{positioning-plus} \include{tikz-ext-manual-en-library-positioning-plus} +\tikzsetfigurename{scalepicture} +\include{tikz-ext-manual-en-library-scalepicture} \tikzsetfigurename{topaths.arcthrough} \include{tikz-ext-manual-en-library-topaths.arcthrough} \tikzsetfigurename{trans} @@ -170,6 +172,11 @@ These libraries (should) work with both \pgfname\space and \tikzname. \section*{Changelog}\addcontentsline{toc}{section}{Changelog} \begin{multicols}{2}\raggedright \noindent +Version 0.4.2 +\begin{itemize} +\item \addTikz{scalepicture} +\item Bugfixes to |shapes.uncenteredrectangle|, |paths.ortho|, |positioning-plus| and |pgfcalender-ext|. +\end{itemize} Version 0.4.1 \begin{itemize} \item Cleaned up directory structure of documentary. diff --git a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-preamble.tex b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-preamble.tex index 2ba6defa100..682b83b4352 100644 --- a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-preamble.tex +++ b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-main-preamble.tex @@ -115,6 +115,7 @@ ext.paths.timer, ext.patterns.images, ext.positioning-plus, + ext.scalepicture, ext.shapes.heatmark, ext.shapes.circlearrow, ext.shapes.circlecrosssplit, diff --git a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.pdf b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.pdf Binary files differindex 51ba04c7d10..855ee19374d 100644 --- a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.pdf +++ b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.pdf diff --git a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.tex b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.tex index 253944ca7db..30705854870 100644 --- a/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.tex +++ b/Master/texmf-dist/doc/latex/tikz-ext/tikz-ext-manual.tex @@ -19,8 +19,8 @@ %mode=list and make, %mode=list only,export=true,% simply skips EVERY picture -> good for debugging the text. ] - \tikzexternalenable -% \tikzexternaldisable +% \tikzexternalenable + \tikzexternaldisable \tikzifexternalizing{ \pgfkeys{/pdflinks/codeexample links=false} }{} diff --git a/Master/texmf-dist/tex/latex/tikz-ext/pgfcalendar-ext.tex b/Master/texmf-dist/tex/latex/tikz-ext/pgfcalendar-ext.tex index 30c44187a4d..11507d5a7ad 100644 --- a/Master/texmf-dist/tex/latex/tikz-ext/pgfcalendar-ext.tex +++ b/Master/texmf-dist/tex/latex/tikz-ext/pgfcalendar-ext.tex @@ -6,7 +6,7 @@ % 2. under the GNU Free Documentation License. % -\input pgfcalendar.text +\input pgfcalendar.tex \catcode`\@=11 \input pgfcalendar-ext.code.tex \catcode`\@=\pgfcalendaratcode diff --git a/Master/texmf-dist/tex/latex/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex b/Master/texmf-dist/tex/latex/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex index 630a22da148..182ebbbcb7f 100644 --- a/Master/texmf-dist/tex/latex/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex +++ b/Master/texmf-dist/tex/latex/tikz-ext/pgflibraryext.shapes.uncenteredrectangle.code.tex @@ -6,8 +6,8 @@ % 2. under the GNU Free Documentation License. % \pgfutil@IfUndefined{pgfnodepartthreebox}{% - \newbox\pgfnodepartleftbox - \newbox\pgfnodepartrightbox + \csname newbox\endcsname\pgfnodepartleftbox + \csname newbox\endcsname\pgfnodepartrightbox }{% \let\pgfnodepartleftbox\pgfnodeparttwobox \let\pgfnodepartrightbox\pgfnodepartthreebox diff --git a/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.paths.ortho.code.tex b/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.paths.ortho.code.tex index 9740c39cc21..216d3e74e3a 100644 --- a/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.paths.ortho.code.tex +++ b/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.paths.ortho.code.tex @@ -42,8 +42,9 @@ %% TikZ interjects are done, the rest is independent: -\newlength\tikzext@tikz@udlr@distance -\newlength\tikzext@tikz@hvvh@distance + +\newdimen\tikzext@tikz@udlr@distance +\newdimen\tikzext@tikz@hvvh@distance \newif\iftikzext@tikz@hvvh@middle % checks whether spacing = 0 was selected \newif\iftikzext@tikz@hvvh@fromcenter \newif\iftikzext@ortho@preflush diff --git a/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.positioning-plus.code.tex b/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.positioning-plus.code.tex index 98de181c272..e430f42a7e6 100644 --- a/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.positioning-plus.code.tex +++ b/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.positioning-plus.code.tex @@ -67,7 +67,7 @@ \tikzset{east below/.code=\tikz@lib@place@handle@{#1}{north east}{0}{-1}{south east}{1}} \newif\iftikzext@tikz@lib@place@postransform -\tikzset{node distance transformation/.is if=qrr@tikz@lib@place@postransform} +\tikzset{node distance transformation/.is if=tikzext@tikz@lib@place@postransform} \def\tikz@lib@place@handle@@#1#2#3#4{% \pgfutil@in@{of }{#1}% \ifpgfutil@in@ diff --git a/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.scalepicture.code.tex b/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.scalepicture.code.tex new file mode 100644 index 00000000000..5ae055bb5d5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-ext/tikzlibraryext.scalepicture.code.tex @@ -0,0 +1,194 @@ +% Copyright 2022 by Qrrbrbirlbel +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +\def\tikzext@scalepicture@savepicturesize{% + \pgf@process{% + \pgfpointdiff + {\pgfpointanchor{current bounding box}{south west}} + {\pgfpointanchor{current bounding box}{north east}}}% + \immediate\write\pgfutil@auxout{% + \noexpand\expandafter\gdef + \noexpand\csname tikzext@scalepicture@\pgfpictureid\endcsname{{\the\pgf@x}{\the\pgf@y}}% + }% + \let\tikzext@scalepicture@savepicturesize\relax +} + +\def\tikzext@scalepicture@width{% + \expandafter\expandafter\expandafter\pgfutil@firstoftwo + \csname tikzext@scalepicture@\pgfpictureid\endcsname +} +\def\tikzext@scalepicture@height{% + \expandafter\expandafter\expandafter\pgfutil@secondoftwo + \csname tikzext@scalepicture@\pgfpictureid\endcsname +} + +\def\tikzextpicturewidth{% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{0pt}{\tikzext@scalepicture@width}} +\def\tikzextpictureheight{% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{0pt}{\tikzext@scalepicture@height}} +\tikzset{ + save picture size/.style={execute at end picture=\tikzext@scalepicture@savepicturesize}, + save picture size/.value forbidden, + %%% keep aspect ratio + %% width and height + minimum picture size/.code 2 args={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \pgfmathsetlength\pgf@ya{#2}% + \def\tikz@tempa{0}% + \def\tikz@temp{0}% + \ifdim\tikzext@scalepicture@width<\pgf@xa + \pgfmathsetmacro\tikz@tempa{\pgf@xa/\tikzext@scalepicture@width}% + \fi + \ifdim\tikzext@scalepicture@height<\pgf@ya + \pgfmathsetmacro\tikz@temp{\pgf@ya/\tikzext@scalepicture@height}% + \fi + \ifdim\tikz@tempa pt>\tikz@temp pt + \let\tikz@temp\tikz@tempa + \fi + \ifdim\tikz@temp pt>0pt + \tikzset{scale/.expand once=\tikz@temp}% + \fi + }% + }, + maximum picture size/.code 2 args={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \pgfmathsetlength\pgf@ya{#2}% + \def\tikz@tempa{0}% + \def\tikz@temp{0}% + \ifdim\tikzext@scalepicture@width>\pgf@xa + \pgfmathsetmacro\tikz@tempa{\pgf@xa/\tikzext@scalepicture@width}% + \fi + \ifdim\tikzext@scalepicture@height>\pgf@ya + \pgfmathsetmacro\tikz@temp{\pgf@ya/\tikzext@scalepicture@height}% + \fi + \ifdim\tikz@tempa pt<\tikz@temp pt + \let\tikz@temp\tikz@tempa + \fi + \ifdim\tikz@temp pt>0pt + \tikzset{scale/.expand once=\tikz@temp}% + \fi + }% + }, + %%% keep aspect ratio + %% width + picture width/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{scale={(#1)/\tikzext@scalepicture@width}}% + }% + }, + minimum picture width/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width<\pgf@xa + \tikzset{scale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + maximum picture width/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width>\pgf@xa + \tikzset{scale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + %%% xscale only + %% width + picture width*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{xscale={(#1)/\tikzext@scalepicture@width}}% + }% + }, + minimum picture width*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width<\pgf@xa + \tikzset{xscale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + maximum picture width*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@xa{#1}% + \ifdim\tikzext@scalepicture@width>\pgf@xa + \tikzset{xscale={\pgf@xa/\tikzext@scalepicture@width}} + \fi + }% + }, + %%% keep aspect ratio + %% height + picture height/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{yscale={(#1)/\tikzext@scalepicture@height}}% + }% + }, + minimum picture height/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{scale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + maximum picture height/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{scale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + %%% yscale only + %% height + picture height*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{yscale={(#1)/\tikzext@scalepicture@height}}% + }% + }, + minimum picture height*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{yscale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + maximum picture height*/.code={% + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \pgfmathsetlength\pgf@ya{#1}% + \ifdim\tikzext@scalepicture@height<\pgf@ya + \tikzset{yscale={\pgf@ya/\tikzext@scalepicture@height}} + \fi + }% + }, + %%% xscale or yscale + picture size*/.code 2 args={% #1 = width, #2 = height + \tikzset{save picture size}% + \pgfutil@IfUndefined{tikzext@scalepicture@\pgfpictureid}{}{% + \tikzset{ + xscale={(#1)/\tikzext@scalepicture@width}, + yscale={(#2)/\tikzext@scalepicture@height}}% + }% + }, +} +\endinput
\ No newline at end of file |