Skip to content

Commit

Permalink
Functionality to print libraries in code listings
Browse files Browse the repository at this point in the history
  • Loading branch information
hmenke committed Jun 24, 2019
1 parent 6311f61 commit 4c3ab05
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions doc/generic/pgf/extract.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ for file in lfs.dir(sourcedir) do
examplefile:write"\\documentclass{article}\n"
examplefile:write"\\usepackage{fp,pgf,tikz,xcolor}\n"
examplefile:write(preamble)
if options["libraries/tikz"] then
examplefile:write("\\usetikzlibrary{" .. options["libraries/tikz"] .. "}\n")
end
if options["libraries/pgf"] then
examplefile:write("\\usepgflibrary{" .. options["libraries/pgf"] .. "}\n")
end
examplefile:write"\\begin{document}\n"
examplefile:write"\\makeatletter\n" -- TODO: this has to go
examplefile:write(setup_code)
Expand Down
13 changes: 12 additions & 1 deletion doc/generic/pgf/macros/pgfmanual-en-macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,10 @@
}
}
}
}
},
libraries/.cd,
tikz/.store in=\code@tikzlibraries,
pgf/.store in=\code@pgflibraries,
}

\def\pgfmanualanimscale{.5}
Expand Down Expand Up @@ -1655,6 +1658,8 @@
\let\code@pre\pgfutil@empty
\let\code@post\pgfutil@empty
\let\code@render\pgfutil@empty
\let\code@tikzlibraries\pgfutil@empty
\let\code@pgflibraries\pgfutil@empty
\def\code@catcode@hook{}

\newif\ifpgfmanual@multipage@code
Expand Down Expand Up @@ -1822,6 +1827,12 @@
\fi}%
\obeylines
\everypar \expandafter{\the\everypar \unpenalty}%
\ifx\code@tikzlibraries\pgfutil@empty\else
\char`\%\string\usetikzlibrary\char`\{\code@tikzlibraries\char`\}
\fi
\ifx\code@pgflibraries\pgfutil@empty\else
\char`\%\string\usetikzlibrary\char`\{\code@pgflibraries\char`\}
\fi
\pgfkeysvalueof{/codeexample/typeset listing/.@cmd}{#1}\pgfeov
}%
}
Expand Down
2 changes: 1 addition & 1 deletion doc/generic/pgf/text-en/pgfmanual-en-base-decorations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ \subsection{Overview}
and, while doing so, either drawing something or constructing a new path. This
could be as simple as extending a path with a ``zigzagged'' line\ldots
%
\begin{codeexample}[]
\begin{codeexample}[libraries/tikz={decorations,decorations.pathmorphing}]
\tikz \draw decorate[decoration=zigzag] {(0,0) -- (3,0)};
\end{codeexample}
%
Expand Down

0 comments on commit 4c3ab05

Please sign in to comment.