Skip to content

Commit

Permalink
docs: add codeexample preambles for short verb
Browse files Browse the repository at this point in the history
Signed-off-by: muzimuzhi <[email protected]>
  • Loading branch information
muzimuzhi committed Jul 26, 2023
1 parent 34e9255 commit 4e28977
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/generic/pgf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Typo fixes in the manual
- Simplify short verb `|...|` or add required preamble for it

### Contributors

Expand Down
2 changes: 1 addition & 1 deletion doc/generic/pgf/pgfmanual-en-base-shadings.tex
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ \subsubsection{General (Functional) Shadings}
defined, which store the individual components of \meta{color name}.
These can also be used in the \meta{type 4 function} argument.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usepackage{shortvrb} \MakeShortVerb{\|}}]
\pgfshadecolortorgb{orange}{\mycol}
|\mycol|=\mycol |\mycolred|=\mycolred |\mycolgreen|=\mycolgreen |\mycolblue|=\mycolblue
\end{codeexample}
Expand Down
10 changes: 5 additions & 5 deletions doc/generic/pgf/pgfmanual-en-pgfkeys.tex
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,12 @@ \subsubsection{Keys That Execute Commands}
``\meta{text}|+|\meta{more text}'' and wishes to store \meta{text} and
\meta{more text} in two different macros. This can be achieved as follows:
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usepackage{shortvrb} \MakeShortVerb{\|}}]
\def\mystore#1+#2\pgfeov{\def\a{#1}\def\b{#2}}
\pgfkeyslet{/my key/.@cmd}{\mystore}
\pgfkeys{/my key=hello+world}

|\a| is \a, |\b| is \b.
|\a| is `\a', |\b| is `\b'.
\end{codeexample}

Naturally, defining the code to be stored in a key in the above manner is too
Expand Down Expand Up @@ -604,7 +604,7 @@ \subsubsection{Keys That Execute Commands}
This command works like |\pgfkeysdef|, but it allows you to provide an
arbitrary \meta{argument count} between $0$ and $9$ (inclusive).
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usepackage{shortvrb} \MakeShortVerb{\|}}]
\pgfkeysdefnargs{/my key}{2}{\def\a{#1}\def\b{#2}}
\pgfkeys{/my key=
{hello}
Expand All @@ -624,11 +624,11 @@ \subsubsection{Keys That Execute Commands}
This command works like |\pgfkeysdefnargs|, but it allows you to provide an
arbitrary \meta{argument pattern} rather than just a number of arguments.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usepackage{shortvrb} \MakeShortVerb{\|}}]
\pgfkeysdefargs{/my key}{#1+#2}{\def\a{#1}\def\b{#2}}
\pgfkeys{/my key=hello+world}

|\a| is \a, |\b| is \b.
|\a| is `\a', |\b| is `\b'.
\end{codeexample}
%
Note that |\pgfkeysdefnargs| is \emph{better} when it comes to simple
Expand Down

0 comments on commit 4e28977

Please sign in to comment.