From c12067684a9401656005aeb3f9a253aec5230a9e Mon Sep 17 00:00:00 2001 From: "matthias@quintern.xyz" Date: Sun, 12 Jan 2025 14:20:02 +0100 Subject: [PATCH] Improve readme --- Makefile | 12 +-- readme.md | 111 ++++++++++++++++++++++++++++ src/cm/{other.tex => misc.tex} | 0 src/ed/ed.tex | 131 --------------------------------- src/ed/misc.tex | 131 +++++++++++++++++++++++++++++++++ src/main.tex | 5 +- src/math/calculus.tex | 97 +++++++++++++----------- src/readme.md | 58 --------------- 8 files changed, 303 insertions(+), 242 deletions(-) create mode 100644 readme.md rename src/cm/{other.tex => misc.tex} (100%) create mode 100644 src/ed/misc.tex delete mode 100644 src/readme.md diff --git a/Makefile b/Makefile index 807c1a5..b298f63 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ # Paths and filenames SRC_DIR = src OUT_DIR = out -MAIN_TEX = $(SRC_DIR)/main.tex -MAIN_PDF = $(OUT_DIR)/main.pdf +MAIN_TEX = main.tex # in SRC_DIR +MAIN_PDF = main.pdf # in OUT_DIR # LaTeX and Biber commands @@ -19,14 +19,14 @@ default: english release: german english # Default target english: - sed -r -i 's/usepackage\[[^]]+\]\{babel\}/usepackage[english]{babel}/' $(MAIN_TEX) + sed -r -i 's/usepackage\[[^]]+\]\{babel\}/usepackage[english]{babel}/' $(SRC_DIR)/$(MAIN_TEX) -cd $(SRC_DIR) && latexmk -lualatex -g main.tex - mv $(MAIN_PDF) $(OUT_DIR)/$(shell date -I)_en_formula_collection.pdf + mv $(OUT_DIR)/$(MAIN_PDF) $(OUT_DIR)/$(shell date -I)_en_Formulary.pdf german: - sed -r -i 's/usepackage\[[^]]+\]\{babel\}/usepackage[german]{babel}/' $(MAIN_TEX) + sed -r -i 's/usepackage\[[^]]+\]\{babel\}/usepackage[german]{babel}/' $(SRC_DIR)/$(MAIN_TEX) -cd $(SRC_DIR) && latexmk -lualatex -g main.tex - mv $(MAIN_PDF) $(OUT_DIR)/$(shell date -I)_de_formelsammlung.pdf + mv $(OUT_DIR)/$(MAIN_PDF) $(OUT_DIR)/$(shell date -I)_de_Formelsammlung.pdf # Clean auxiliary and output files clean: diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..8dd2e62 --- /dev/null +++ b/readme.md @@ -0,0 +1,111 @@ +# Formulary +This is supposed to be a compact, searchable collection of the most important stuff I learned during my physics studides, +because it would be a shame if I forget it all! + +## Building the PDF +### Dependencies +Any recent **TeX Live** distribution should work. You need: +- `LuaLaTeX` compiler +- several packages from ICAN +- `latexmk` to build it + +### With GNU make +1. In the project directory (where this `readme` is), run `make german` or `make english`. +2. Rendered document will be `out/_.pdf` + +### With Latexmk +1. Choose the language: In `main.tex`, set the language in `\usepackage[english]{babel}` to either `english` or `german` +2. In the `src` directory, run `latexmk -lualatex main.tex` +3. Rendered document will be `out/main.pdf` + +### With LuaLatex +1. Choose the language: In `main.tex`, set the language in `\usepackage[english]{babel}` to either `english` or `german` +2. Create the `.aux` directory +3. In the `src` directory, run + - `lualatex -output-directory="../.aux" --interaction=nonstopmode --shell-escape "main.tex"` **3 times** +4. Rendered document will be `.aux/main.pdf` + +# LaTeX Guideline +Here is some info to help myself remember why I did things the way I did. + +In general, most content should be written with macros, so that the behaviour can be changed later. + +## Structure +All translation keys and LaTeX labels should use a structured approach: +`::
::<...>:` + +The `:...:` will be defined as `\fqname` (fully qualified name) when using the `\Part`, `\Section`, ... commands. + +`` is: + +- formula: `f` +- equation: `eq` +- table: `tab` +- figure: `fig` +- parts, (sub)sections: `sec` + +### Files and directories +Separate parts in different source files named `.tex`. +If a part should be split up in multiple source files itself, use a +subdirectory named `` containing `.tex` and other source files for sections. +This way, the `fqname` of a section or formula partially matches the path of the source file it is in. + +## `formula` environment +The main way to display something is the formula environment: +```tex +\begin{formula}{} + \desc{English name}{English description}{$q$ is some variable, $s$ \qtyRef{some_quantity}} + \desc[german]{Deutscher Name}{Deutsche Beschreibung}{$q$ ist eine Variable, $s$ \qtyRef{some_quantity}} + +\end{formula} +``` +Each formula automatically gets a `f:
:` label. +For the content, several macros are available: +- `\eq{}` a wrapper for the `align` environment +- `\fig[width]{}` +- `\quantity{}{}{}` for physical quantites +- `\constant{}{ }` for constants, where `` may contain one or more `\val{value}{unit}` commands. + +### References +**Use references where ever possible.** +In equations, reference or explain every variable. Several referencing commands are available for easy referencing: +- `\fqSecRef{}` prints the translated title of the section +- `\fqEqRef{}` prints the translated title of the formula (first argument of `\desc`) +- `\qtyRef{}` prints the translated name of the quantity +- `\QtyRef{}` prints the symbol and the translated name of the quantity +- `\constRef{}` prints the translated name of the constant +- `\ConstRef{}` prints the symbol and the translated name of the constant +- `\elRef{}` prints the symbol of the chemical element +- `\ElRef{}` prints the name of the chemical element + + +## Multilanguage +All text should be defined as a translation (`translations` package, see `util/translation.tex`). +Use `\dt` or `\DT` or the the shorthand language commands `\eng`, `\Eng` etc. to define translations. +These commands also be write the translations to an auxiliary file, which is read after the document begins. +This means (on subsequent compilations) that the translation can be resolved before they are defined. +Use the `gt` or `GT` macros to retrieve translations. +The english translation of any key must be defined, because it will also be used as fallback. + +Lower case macros are relative to the current `fqname`, while upper case macros are absolute. + +Never make a macro that would have to be changed if a new language was added, eg dont do +```tex +% 1: key, 2: english version, 3: german version +\newcommand{\mycmd}[3]{ + \dosomestuff{english}{#1}{#2} + \dosomestuff{german}{#1}{#3} +} + +\mycmd{key}{this is english}{das ist deutsch} +``` +Instead, do +```tex +% [1]: lang, 2: key, 2: text +\newcommand{\mycmd}[3][english]{ + \dosomestuff{#1}{#2}{#3} +} + +\mycmd{key}{this is english} +\mycmd[german]{key}{das ist deutsch} +``` diff --git a/src/cm/other.tex b/src/cm/misc.tex similarity index 100% rename from src/cm/other.tex rename to src/cm/misc.tex diff --git a/src/ed/ed.tex b/src/ed/ed.tex index 28d6311..e3a0b30 100644 --- a/src/ed/ed.tex +++ b/src/ed/ed.tex @@ -6,134 +6,3 @@ % pure electronic stuff in el % pure magnetic stuff in mag % electromagnetic stuff in em - -% TODO move -\Section[ - \eng{Hall-Effect} - \ger{Hall-Effekt} - ]{hall} - - \begin{formula}{cyclotron} - \desc{Cyclontron frequency}{}{} - \desc[german]{Zyklotronfrequenz}{}{} - \eq{\omega_\text{c} = \frac{e B}{\masse}} - \end{formula} - \TODO{Move} - - - \Subsection[ - \eng{Classical Hall-Effect} - \ger{Klassischer Hall-Effekt} - ]{classic} - \begin{ttext} - \eng{Current flowing in $x$ direction in a conductor ($l \times b \times d$) with a magnetic field $B$ in $z$ direction leads to a hall voltage $U_\text{H}$ in $y$ direction.} - \ger{Fließt in einem Leiter ($l \times b \times d$) ein Strom in $x$ Richtung, während der Leiter von einem Magnetfeld $B$ in $z$-Richtung durchdrungen, wird eine Hallspannung $U_\text{H}$ in $y$-Richtung induziert.} - \end{ttext} - \begin{formula}{voltage} - \desc{Hall voltage}{}{$n$ charge carrier density} - \desc[german]{Hallspannung}{}{$n$ Ladungsträgerdichte} - \eq{U_\text{H} = \frac{I B}{ne d}} - \end{formula} - - \begin{formula}{coefficient} - \desc{Hall coefficient}{Sometimes $R_\txH$}{} - \desc[german]{Hall-Koeffizient}{Manchmal $R_\txH$}{} - \eq{A_\text{H} := -\frac{E_y}{j_x B_z} \explOverEq{\GT{metals}} \frac{1}{ne} = \frac{\rho_{xy}}{B_z}} - \end{formula} - - \begin{formula}{resistivity} - \desc{Resistivity}{}{} - \desc[german]{Spezifischer Widerstand}{}{} - \eq{\rho_{xx} &= \frac{\masse}{ne^2\tau} \\ \rho_{xy} &= \frac{B}{ne}} - \end{formula} - - - \Subsection[ - \eng{Integer quantum hall effect} - \ger{Ganzahliger Quantenhalleffekt} - ]{quantum} - - \begin{formula}{conductivity} - \desc{Conductivity tensor}{}{} - \desc[german]{Leitfähigkeitstensor}{}{} - \eq{\sigma = \begin{pmatrix} \sigma_{xy} & \sigma_{xy} \\ \sigma_{yx} & \sigma_{yy} \end{pmatrix} } - \end{formula} - - \begin{formula}{resistivity_tensor} - \desc{Resistivity tensor}{}{} - \desc[german]{Spezifischer Widerstands-tensor}{}{} - \eq{ - \rho = \sigma^{-1} - % \sigma = \begin{pmatrix} \sigma_{xy} & \sigma_{xy} \\ \sigma_{yx} & \sigma_{yy} \end{pmatrix} } - } - \end{formula} - - \begin{formula}{resistivity} - \desc{Resistivity}{}{$\nu \in \mathbb{Z}$ filing factor} - \desc[german]{Spezifischer Hallwiderstand}{}{$\nu \in \mathbb{Z}$ Füllfaktor} - \eq{\rho_{xy} = \frac{2\pi\hbar}{e^2} \frac{1}{\nu}} - \end{formula} - - % \begin{formula}{qhe} - % \desc{Integer quantum hall effect}{}{} - % \desc[german]{Ganzahliger Quanten-Hall-Effekt}{}{} - % \fig{img/qhe-klitzing.jpeg} - % \end{formula} - - \begin{formula}{fqhe} - \desc{Fractional quantum hall effect}{}{$\nu$ fraction of two numbers without shared divisors} - \desc[german]{Fraktionaler Quantum-Hall-Effekt}{}{$\nu$ Bruch aus Zahlen ohne gemeinsamen Teiler} - \eq{\nu = \frac{1}{3},\frac{2}{5},\frac{3}{7},\frac{2}{3}...} - \end{formula} - - \begin{ttext} - \eng{ - \begin{itemize} - \item \textbf{Integer} (QHE): filling factor $\nu$ is an integer - \item \textbf{Fractional} (FQHE): filling factor $\nu$ is a fraction - \item \textbf{Spin} (QSHE): spin currents instead of charge currents - \item \textbf{Anomalous} (QAHE): symmetry breaking by internal effects instead of external magnetic fields - \end{itemize} - } - \ger{ - \begin{itemize} - \item \textbf{Integer} (QHE): Füllfaktor $\nu$ ist ganzzahlig - \item \textbf{Fractional} (FQHE): Füllfaktor $\nu$ ist ein Bruch - \item \textbf{Spin} (QSHE): Spin Ströme anstatt Ladungsströme - \item \textbf{Anomalous} (QAHE): Symmetriebruch durch interne Effekte anstatt druch ein externes Magnetfeld - \end{itemize} - } - \end{ttext} - - - \TODO{sort} - \begin{formula}{impedance_c} - \desc{Impedance of a capacitor}{}{} - \desc[german]{Impedanz eines Kondesnators}{}{} - \eq{Z_{C} = \frac{1}{i\omega C}} - \end{formula} - - \begin{formula}{impedance_l} - \desc{Impedance of an inductor}{}{} - \desc[german]{Impedanz eines Induktors}{}{} - \eq{Z_{L} = i\omega L} - \end{formula} - - \TODO{impedance addition for parallel / linear} - -\Section[ - \eng{Dipole-stuff} - \ger{Dipol-zeug} -]{dipole} - - \begin{formula}{poynting} - \desc{Dipole radiation Poynting vector}{}{} - \desc[german]{Dipolsrahlung Poynting-Vektor}{}{} - \eq{\vec{S} = \left(\frac{\mu_0 p_0^2 \omega^4}{32\pi^2 c}\right)\frac{\sin^2\theta}{r^2} \vec{r}} - \end{formula} - - \begin{formula}{power} - \desc{Time-average power}{}{} - \desc[german]{Zeitlich mittlere Leistung}{}{} - \eq{P = \frac{\mu_0\omega^4 p_0^2}{12\pi c}} - \end{formula} diff --git a/src/ed/misc.tex b/src/ed/misc.tex new file mode 100644 index 0000000..1204d16 --- /dev/null +++ b/src/ed/misc.tex @@ -0,0 +1,131 @@ +% TODO move +\Section[ + \eng{Hall-Effect} + \ger{Hall-Effekt} + ]{hall} + + \begin{formula}{cyclotron} + \desc{Cyclontron frequency}{}{} + \desc[german]{Zyklotronfrequenz}{}{} + \eq{\omega_\text{c} = \frac{e B}{\masse}} + \end{formula} + \TODO{Move} + + + \Subsection[ + \eng{Classical Hall-Effect} + \ger{Klassischer Hall-Effekt} + ]{classic} + \begin{ttext} + \eng{Current flowing in $x$ direction in a conductor ($l \times b \times d$) with a magnetic field $B$ in $z$ direction leads to a hall voltage $U_\text{H}$ in $y$ direction.} + \ger{Fließt in einem Leiter ($l \times b \times d$) ein Strom in $x$ Richtung, während der Leiter von einem Magnetfeld $B$ in $z$-Richtung durchdrungen, wird eine Hallspannung $U_\text{H}$ in $y$-Richtung induziert.} + \end{ttext} + \begin{formula}{voltage} + \desc{Hall voltage}{}{$n$ charge carrier density} + \desc[german]{Hallspannung}{}{$n$ Ladungsträgerdichte} + \eq{U_\text{H} = \frac{I B}{ne d}} + \end{formula} + + \begin{formula}{coefficient} + \desc{Hall coefficient}{Sometimes $R_\txH$}{} + \desc[german]{Hall-Koeffizient}{Manchmal $R_\txH$}{} + \eq{A_\text{H} := -\frac{E_y}{j_x B_z} \explOverEq{\GT{metals}} \frac{1}{ne} = \frac{\rho_{xy}}{B_z}} + \end{formula} + + \begin{formula}{resistivity} + \desc{Resistivity}{}{} + \desc[german]{Spezifischer Widerstand}{}{} + \eq{\rho_{xx} &= \frac{\masse}{ne^2\tau} \\ \rho_{xy} &= \frac{B}{ne}} + \end{formula} + + + \Subsection[ + \eng{Integer quantum hall effect} + \ger{Ganzahliger Quantenhalleffekt} + ]{quantum} + + \begin{formula}{conductivity} + \desc{Conductivity tensor}{}{} + \desc[german]{Leitfähigkeitstensor}{}{} + \eq{\sigma = \begin{pmatrix} \sigma_{xy} & \sigma_{xy} \\ \sigma_{yx} & \sigma_{yy} \end{pmatrix} } + \end{formula} + + \begin{formula}{resistivity_tensor} + \desc{Resistivity tensor}{}{} + \desc[german]{Spezifischer Widerstands-tensor}{}{} + \eq{ + \rho = \sigma^{-1} + % \sigma = \begin{pmatrix} \sigma_{xy} & \sigma_{xy} \\ \sigma_{yx} & \sigma_{yy} \end{pmatrix} } + } + \end{formula} + + \begin{formula}{resistivity} + \desc{Resistivity}{}{$\nu \in \mathbb{Z}$ filing factor} + \desc[german]{Spezifischer Hallwiderstand}{}{$\nu \in \mathbb{Z}$ Füllfaktor} + \eq{\rho_{xy} = \frac{2\pi\hbar}{e^2} \frac{1}{\nu}} + \end{formula} + + % \begin{formula}{qhe} + % \desc{Integer quantum hall effect}{}{} + % \desc[german]{Ganzahliger Quanten-Hall-Effekt}{}{} + % \fig{img/qhe-klitzing.jpeg} + % \end{formula} + + \begin{formula}{fqhe} + \desc{Fractional quantum hall effect}{}{$\nu$ fraction of two numbers without shared divisors} + \desc[german]{Fraktionaler Quantum-Hall-Effekt}{}{$\nu$ Bruch aus Zahlen ohne gemeinsamen Teiler} + \eq{\nu = \frac{1}{3},\frac{2}{5},\frac{3}{7},\frac{2}{3}...} + \end{formula} + + \begin{ttext} + \eng{ + \begin{itemize} + \item \textbf{Integer} (QHE): filling factor $\nu$ is an integer + \item \textbf{Fractional} (FQHE): filling factor $\nu$ is a fraction + \item \textbf{Spin} (QSHE): spin currents instead of charge currents + \item \textbf{Anomalous} (QAHE): symmetry breaking by internal effects instead of external magnetic fields + \end{itemize} + } + \ger{ + \begin{itemize} + \item \textbf{Integer} (QHE): Füllfaktor $\nu$ ist ganzzahlig + \item \textbf{Fractional} (FQHE): Füllfaktor $\nu$ ist ein Bruch + \item \textbf{Spin} (QSHE): Spin Ströme anstatt Ladungsströme + \item \textbf{Anomalous} (QAHE): Symmetriebruch durch interne Effekte anstatt druch ein externes Magnetfeld + \end{itemize} + } + \end{ttext} + + + \TODO{sort} + \begin{formula}{impedance_c} + \desc{Impedance of a capacitor}{}{} + \desc[german]{Impedanz eines Kondesnators}{}{} + \eq{Z_{C} = \frac{1}{i\omega C}} + \end{formula} + + \begin{formula}{impedance_l} + \desc{Impedance of an inductor}{}{} + \desc[german]{Impedanz eines Induktors}{}{} + \eq{Z_{L} = i\omega L} + \end{formula} + + \TODO{impedance addition for parallel / linear} + +\Section[ + \eng{Dipole-stuff} + \ger{Dipol-zeug} +]{dipole} + + \begin{formula}{poynting} + \desc{Dipole radiation Poynting vector}{}{} + \desc[german]{Dipolsrahlung Poynting-Vektor}{}{} + \eq{\vec{S} = \left(\frac{\mu_0 p_0^2 \omega^4}{32\pi^2 c}\right)\frac{\sin^2\theta}{r^2} \vec{r}} + \end{formula} + + \begin{formula}{power} + \desc{Time-average power}{}{} + \desc[german]{Zeitlich mittlere Leistung}{}{} + \eq{P = \frac{\mu_0\omega^4 p_0^2}{12\pi c}} + \end{formula} + diff --git a/src/main.tex b/src/main.tex index 2cf49bf..ca742b1 100644 --- a/src/main.tex +++ b/src/main.tex @@ -1,7 +1,7 @@ %! TeX program = lualatex % (for vimtex) \documentclass[11pt, a4paper]{article} -% \usepackage[utf8]{inputenc} +% SET LANGUAGE HERE \usepackage[english]{babel} \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} % ENVIRONMENTS etc @@ -277,6 +277,7 @@ \Input{ed/el} \Input{ed/mag} \Input{ed/em} +\Input{ed/misc} \Input{quantum_mechanics} \Input{atom} @@ -287,7 +288,7 @@ \Input{cm/charge_transport} \Input{cm/low_temp} \Input{cm/semiconductors} -\Input{cm/other} +\Input{cm/misc} \Input{cm/techniques} \Input{topo} diff --git a/src/math/calculus.tex b/src/math/calculus.tex index b879109..88ca21a 100644 --- a/src/math/calculus.tex +++ b/src/math/calculus.tex @@ -11,50 +11,6 @@ % } % \end{formula} - \Subsection[ - \eng{Convolution} - \ger{Faltung / Konvolution} - ]{conv} - \begin{ttext} - \eng{Convolution is \textbf{commutative}, \textbf{associative} and \textbf{distributive}.} - \ger{Die Faltung ist \textbf{kommutativ}, \textbf{assoziativ} und \textbf{distributiv}} - \end{ttext} - \begin{formula}{def} - \desc{Definition}{}{} - \desc[german]{Definition}{}{} - \eq{(f*g)(t) = f(t) * g(t) = \int_{-\infty}^\infty f(\tau) g(t-\tau) \d \tau} - \end{formula} - \begin{formula}{notation} - \desc{Notation}{}{} - \desc[german]{Notation}{}{} - \eq{ - f(t) * g(t-t_0) &= (f*g)(t-t_0) \\ - f(t-t_0) * g(t-t_0) &= (f*g)(t-2t_0) - } - \end{formula} - \begin{formula}{commutativity} - \desc{Commutativity}{}{} - \desc[german]{Kommutativität}{}{} - \eq{f * g = g * f} - \end{formula} - - \begin{formula}{associativity} - \desc{Associativity}{}{} - \desc[german]{Assoziativität]}{}{} - \eq{(f*g)*h = f*(g*h)} - \end{formula} - - \begin{formula}{distributivity} - \desc{Distributivity}{}{} - \desc[german]{Distributivität}{}{} - \eq{f * (g + h) = f*g + f*h} - \end{formula} - - \begin{formula}{complex_conjugate} - \desc{Complex conjugate}{}{} - \desc[german]{Komplexe konjugation}{}{} - \eq{(f*g)^* = f^* * g^*} - \end{formula} \Subsection[ \eng{Fourier analysis} @@ -98,7 +54,6 @@ \TODO{cleanup} - \Subsubsection[ \eng{Fourier transformation} \ger{Fouriertransformation} @@ -120,6 +75,52 @@ \end{enumerate} + \Subsubsection[ + \eng{Convolution} + \ger{Faltung / Konvolution} + ]{conv} + \begin{ttext} + \eng{Convolution is \textbf{commutative}, \textbf{associative} and \textbf{distributive}.} + \ger{Die Faltung ist \textbf{kommutativ}, \textbf{assoziativ} und \textbf{distributiv}} + \end{ttext} + \begin{formula}{def} + \desc{Definition}{}{} + \desc[german]{Definition}{}{} + \eq{(f*g)(t) = f(t) * g(t) = \int_{-\infty}^\infty f(\tau) g(t-\tau) \d \tau} + \end{formula} + \begin{formula}{notation} + \desc{Notation}{}{} + \desc[german]{Notation}{}{} + \eq{ + f(t) * g(t-t_0) &= (f*g)(t-t_0) \\ + f(t-t_0) * g(t-t_0) &= (f*g)(t-2t_0) + } + \end{formula} + \begin{formula}{commutativity} + \desc{Commutativity}{}{} + \desc[german]{Kommutativität}{}{} + \eq{f * g = g * f} + \end{formula} + + \begin{formula}{associativity} + \desc{Associativity}{}{} + \desc[german]{Assoziativität]}{}{} + \eq{(f*g)*h = f*(g*h)} + \end{formula} + + \begin{formula}{distributivity} + \desc{Distributivity}{}{} + \desc[german]{Distributivität}{}{} + \eq{f * (g + h) = f*g + f*h} + \end{formula} + + \begin{formula}{complex_conjugate} + \desc{Complex conjugate}{}{} + \desc[german]{Komplexe konjugation}{}{} + \eq{(f*g)^* = f^* * g^*} + \end{formula} + + \Subsection[ \eng{Misc} \ger{Verschiedenes} @@ -147,6 +148,12 @@ \eq{\delta(f(x)) = \frac{\delta(x-x_0)}{\abs{g'(x_0)}}} \end{formula} + \begin{formula}{geometric_series} + \desc{Geometric series}{}{$\abs{q}<1$} + \desc[german]{Geometrische Reihe}{}{} + \eq{\sum_{k=0}^{\infty}q^k = \frac{1}{1-q}} + \end{formula} + \Subsection[ \eng{Logarithm} diff --git a/src/readme.md b/src/readme.md deleted file mode 100644 index ef3fe96..0000000 --- a/src/readme.md +++ /dev/null @@ -1,58 +0,0 @@ -# Knowledge Collection -This is supposed to be a compact, searchable collection of the most important stuff I had to during my physics studides, -because it would be a shame if I forget it all! - -# LaTeX Guideline -Here is some info to help myself remember why I did things the way I did. - -In general, most content should be written with macros, so that the behaviour can be changed later. - -## `fqname` -All translation keys and LaTeX labels should use a structured approach: -`::
::<...>:` - -The `:...:` will be defined as `fqname` (fully qualified name) macro when using the `\Part`, `\Section`, ... macros. - -`` should be - -- equation: `eq` -- table: `tab` -- figure: `fig` -- parts, (sub)sections: `sec` - -### Reference functions -Functions that create a hyperlink (and use the translation of the target element as link name): -- `\fqSecRef{}` -- `\fqEqRef{}` - - -## Multilanguage -All text should be defined as a translation (`translations` package, see `util/translation.tex`). -Use `\dt` or `\DT` or the the shorthand language commands `\eng`, `\Eng` etc. to define translations. -These commands also be write the translations to an auxiliary file, which is read after the document begins. -This means (on subsequent compilations) that the translation can be resolved before they are defined. -Use the `gt` or `GT` macros to retrieve translations. -The english translation of any key must be defined, because it will also be used as fallback. - -Lower case macros are relative to the current `fqname`, while upper case macros are absolute. - -Never make a macro that would have to be changed if a new language was added, eg dont do -```tex -% 1: key, 2: english version, 3: german version -\newcommand{\mycmd}[3]{ - \dosomestuff{english}{#1}{#2} - \dosomestuff{german}{#1}{#3} -} - -\mycmd{key}{this is english}{das ist deutsch} -``` -Instead, do -```tex -% [1]: lang, 2: key, 2: text -\newcommand{\mycmd}[3][english]{ - \dosomestuff{#1}{#2}{#3} -} - -\mycmd{key}{this is english} -\mycmd[german]{key}{das ist deutsch} -```