Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/muzimuzhi/latex-examples

small (la)tex files showing features, solutions, and attempts
https://github.com/muzimuzhi/latex-examples

latex latex-examples

Last synced: 30 days ago
JSON representation

small (la)tex files showing features, solutions, and attempts

Awesome Lists containing this project

README

        

# LaTeX examples

- Dec 13, 2022
Rewrote whole Git history to track all PDF files with Git LFS.\
(by executing `git lfs migrate import --include="*.pdf" --everything`).

## Utilities

### [`code-with-output.tex`](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 libraries `hooks`, `minted`, `skins` and `xparse` loaded
- `accsupp`
- environments are based on `tcolorbox`'s `minted` library, `-shell-escape` required
- added
- `\emptyaccsupp`
- `tcolorbox` options `example options` and `example title`
- modified
- `\theFancyVerbLine`

### [`pgfkeys` library `conditionals`](utilities/pgfkeyslibraryconditionals.code.tex)

User Interface
- loading: `\usepgfkeyslibrary{conditionals}`
- conditional keys
- `/utils/ifname nTF={}{}{}`
executes `\if ... \else ... \fi`
- `/utils/ifxxx nTF={}{}{}`
executes ` ... \else ... \fi`
- `/utils/ifnum nNnTF={}{}{}{}`
(trick: hide `` `=` in braces, like `/utils/ifnum 1{=}1tf`)
- `/utils/ifdim nNnTF={}{}{}{}`
- `/utils/if NNTF={}{}`
(`\noexpand` auto applied to `` and ``)
- `/utils/ifcat NNTF={}{}` (ditto)
- `/utils/ifx NNTF={}{}`
- `/utils/if strcmp nTnTF={}{}{}{}`
(`` are auto wrapped by `\unexpanded`; relies on primitive `\(pdf)strcmp` or its mock in Lua)

Internals
- prefix `\pgfkeys@lib@cond@xxx`

TODO
- export to other default paths\
to support uses like `\tcbset{ifnum TF=...}` with no need to set `\pgfkeys{/tcb/.see also={/utils}}`. Also more space consumption for shorter time.
- utility to copy a key (need to learn if `filtered` library adds any internal sub-keys)

### [`hyperref-autonameref.tex`](utilities/hyperref-autonameref.tex)

User Interface
- `\autonameref{}` and `\autonameref*{}`
- 1-arg `\HyRef@autonameref@style` which controls the extra output style (see [test file](test/hyperref-autonameref-test.tex))

Internals
- direct dependency: `hyperref`
- `\HyRef@autonameref` and `\HyRef@autonamesetref`

### [`pgfkeys-handler-patch.tex`](utilities/pgfkeys-handler-patch.tex)

User Interface
- `\pgfkeys{/.patch={}{}}`
- `\pgfkeyspatchvalue{}{}{}`

Internals
- direct dependency: `xpatch`

### [`pgfkeys-handler-store-in.tex`](utilities/pgfkeys-handler-store-in.tex)

User Interface
- after `/.store in=` (or `.estore in`), handlers `.get`, `.add`, `.prefix`, and `.append` will act on ``, not the key itself

Internals
- `` is stored in new sub-key `.@store`, which will be cleared by `.initial`
- for the above four handlers, `.@store` has higher precedence than the key itself (set by `.initial`)

### [`print-definition.tex`](utilities/print-definition.tex)

User Interface
- `\printDef{csname}`, print definition of `\cs{csname}`
- `\printAndRunCode{code}`

Internals
- direct dependencies:
- `fvextra`
- `xcolor` with no package options
- added
- `\toString`

### [`tikz-auto-mark-nodes.tex`](utilities/tikz-auto-mark-nodes.tex)

User Interface
- scope options `auto mark` and `no auto mark`
- styles `every auto mark` and `every auto mark` that accept `pin` options
- zero-arg macro `\tikzAutoMarkText` that controls the mark text
- In the definition of the above styles and macro, `\tikzNodeName` and `\tikzNodeShape` can be used as placeholders of node name and shape, respectively.

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
```tex
\node also[pin={[every auto mark/.try, every auto mark/.try]{\tikzAutoMarkText}}] (\tikzNodeName);
```
at the end of every `tikzpicture`.
- maybe draw in `execute at end path`?
- direct dependency: `tikz` and `etoolbox` (for `\patchcmd`)
- `tikz` options used: `execute at begin scope` and `execute at end picture`
- patched: `\tikz@node@finish` to append node info to `\tikzNodeList`
- added:
- `\tikzNodeList`, A comma-separated list of elements `{, }`
- `\newif\iftikz@lib@automark@on`

### [`unique-csname.tex`](utilities/unique-csname.tex)

User Interface
- `\undefine` and `\undefinecs{}` un-define a control sequence locally
- `\uniquecsname` expands to a `` which tests false in `\ifcsname`

Internals
- `\@uniquecsname@try` and `\@uniquecsname@generate`

### [`xcolor-quick-variants.tex`](utilities/xcolor-quick-variants.tex) (wip)

User Interface
- `\defineqcolor{}{}{}`
- `\colorqlet{}{}`
- `\qcolor{}` or `\qcolor[]{}`
- ` ::= gray | rgb | cmyk`

Internal
- `\XC@nametocs{}`