latex-examples
latex-examples copied to clipboard
small (la)tex files showing features, solutions, and attempts
LaTeX examples
utilities/code-with-output.tex
User Interface
\begin{example}[tcb options]{title}, code followed by output, numbered\begin{example*}[tcb options]{title}, unnumbered variant
Typical configured usage
- side by side,
\begin{example}[sidebyside]{title} - change code language,
\begin{example}[minted options app={language=python}]{title}
Internals
- direct dependencies:
tcolorbox, with librarieshooks,minted,skinsandxparseloadedaccsupp
- environments are based on
tcolorbox'smintedlibrary,-shell-escaperequired - added
\emptyaccsupptcolorboxoptionsexample optionsandexample title
- modified
\theFancyVerbLine
utilities/print-definition.tex
User Interface
\printDef{csname}, print definition of\cs{csname}\printAndRunCode{code}
Internals
- direct dependencies:
fvextraxcolorwith no package options
- added
\toString
utilities/pgfkeys-handler-patch.tex
User Interface
\pgfkeys{<key>/.patch={<search>}{<replace>}}\pgfkeyspatchvalue{<key path>}{<search>}{<replace>}
Internals
- direct dependency:
xpatch
utilities/pgfkeys-handler-store-in.tex
User Interface
- after
<key>/.store in=<macro>(or.estore in), handlers.get,.add,.prefix, and.appendwill act on<macro>, not the key itself
Internals
<macro>is stored in new subkey.@store, which will be cleared by.initial- for the above four handlers,
.@storehas higher precedence than the key itself (set by.initial)
utilities/hyperref-autonameref.tex
User Interface
\autonameref{<label key>}and\autonameref*{<label key>}- 1-arg
\HyRef@autonameref@stylewhich controls the extra output style (see test file)
Internals
- direct dependency:
hyperref \HyRef@autonamerefand\HyRef@autonamesetref
utilities/tikz-auto-mark-nodes.tex
User Interface
- scope options
auto markandno auto mark - styles
every auto markandevery auto <shape> markthat acceptpinoptions - zero-arg macro
\tikzAutoMarkTextthat controls the mark text- In the definition of the above styles and macro,
\tikzNodeNameand\tikzNodeShapecan be used as placeholders of node name and shape, respectively.
- In the definition of the above styles and macro,
Initial values
```tex
\tikzset{
every auto mark/.style={
font=\ttfamily, rotate=45,
red, anchor=west, pin position=45,
},
every auto coordinate mark/.style={
blue, anchor=east, pin position=180+45,
},
}
\newcommand\tikzAutoMarkText{\tikzNodeName}
```
Internals
- Every auto mark is a node pin drawn by
at the end of every\node also[pin={[every auto mark/.try, every auto <shape> mark/.try]{\tikzAutoMarkText}}] (\tikzNodeName);tikzpicture.- maybe draw in
execute at end path?
- maybe draw in
- direct dependency:
tikzandetoolbox(for\patchcmd) tikzoptions used:execute at begin scopeandexecute at end picture- patched:
\tikz@node@finishto append node info to\tikzNodeList - added:
\tikzNodeList, A comma-separated list of elements{<node_name>, <node_shape>}\newif\iftikz@lib@automark@on