4 LaTeX

4.1 Testing

If the Portable Document Format file would not be produced and it is cumbersome to figure out the error based on the log file then one can use pdflatex for testing the intermediate TEX-file as shown in (11)[30].

  1. Usage of pdflatex.

    pdflatex <name-of-file>.tex  # 1
                                 # 2

4.2 Layout

4.2.1 Page Orientation

\begin{landscape}                                                           # 1
                                                                            # 2
Here is anything but figures that needs to be displayed in landscape mode.  # 3
                                                                            # 4
\end{landscape}                                                             # 5
                                                                            # 6
librarian::shelf(c(                            # 1
  "formatdown"                                 # 2
))                                             # 3
numbers <- c(123.456, 2e-6, 5e8, 0.23)         # 4
format_power_numbers <- format_power(numbers)  # 5
## Warning in format_power(numbers): `format_power()` is deprecated. Use `format_numbers()`
##               which offers additional arguments and access to package options.
format_power_numbers_digits <- format_power(numbers, format = "sci", digits = 2, omit_power=NULL)  # 1
## Warning in format_power(numbers, format = "sci", digits = 2, omit_power = NULL): `format_power()` is deprecated. Use `format_numbers()`
##               which offers additional arguments and access to package options.
format_power_numbers_digits  # 1
## [1] "$\\small 1.2 \\times 10^{2}$"  "$\\small 2.0 \\times 10^{-6}$"
## [3] "$\\small 5.0 \\times 10^{8}$"  "$\\small 2.3 \\times 10^{-1}$"

4.2.2 Justifying text

The example (12) shows how to center items[31(p. 64)].

  1. \begin{center}centered item\end{center}

4.3 List of tables and figures

Normally, the caption for a list of tables and a list of figures is shown no matter whether tables or figures exist. i found a solution for only displaying a list if there’s an item available for that[32]. That code is in preamble.\(\mathrm{ \TeX{} }\) under the corresponding caption as a comment. Using the package xassoccnt triggers the warning:

Warning: Package xassoccnt Warning: Warning: Package “calc” is loaded – this is not  Warning: (xassoccnt) recommended for xassoccnt  Warning: (xassoccnt)

calc is being called directly from default.\(\mathrm{ \LaTeX{} }\) and as i don’t want to modify the contents of default.\(\mathrm{ \LaTeX{} }\), i have to live with the warning.

4.4 Reference to a page

If a referenced equation, figure, table or other item is on a different page, i also reference the page number:

`r render_pageref(reference = "fig:workflow")`  # 1
                                                # 2

… on the page .

This only works for the print output as there are no pages on a webpage.

4.5 The non-math \(\mathrm{ \LaTeX{} }\) string

`r render_nonmath_LaTeX_string_universal("\\LaTeX{}")`    # 1
                                                          # 2

\(\mathrm{ \LaTeX{} }\)

4.6 Spacing

4.6.1 Space after macro

Using a macro without braces at the end removes the possible spacing from after it in PDF[33(p. 181)]:

`r render_nonmath_LaTeX_string_universal("\\LaTeX{}")` <text after space>    # 1
                                                                             # 2
`r render_nonmath_LaTeX_string_universal("\\LaTeX")` <text after space>      # 3
                                                                             # 4

\(\mathrm{ \LaTeX{} }\) <text after space>

\(\mathrm{ \LaTeX }\) <text after space>

4.6.2 Horizontal fill

For a horizontal fill, hfill can be used[34]:

Harku      # 1
\hfill     # 2
2022-2023  # 3
           # 4

Harku -2023

4.6.3 Vertical fill

For a vertical fill, vfill can be used:

Harku      # 1
\vfill     # 2
2022-2023  # 3
           # 4

Harku -2023

4.7 Columns

If i want the following text to be in two columns i write:

\twocolumn    # 1
              # 2

i’m just writing some text that will be placed in two columns because it’s easier to read if the text is in two columns.

If i want the following text to be in one column, i write:

\onecolumn    # 1
              # 2

I am just writing some text that will be placed in one column because it can contain a figure or equation that does not fit in a narrower column.

                                       # 1
\begin{multicols}{2}                   # 2
- titaandioksiid: \ce{TiO2};           # 3
                                       # 4
- ränitetrakloriid: \ce{SiCl4};        # 5
                                       # 6
- süsinikdisulfiid: \ce{CS2};          # 7
                                       # 8
- vääveltetrafluoriid: \ce{SF4};       # 9
                                      # 10
- liitiumsulfiid: \ce{Li2S};          # 11
                                      # 12
- antimonpentafluoriid: \ce{SbF5};    # 13
                                      # 14
- dilämmastikpentooksiid: \ce{N2O5};  # 15
                                      # 16
- joodheptafluoriid: \ce{IF7}.        # 17
\end{multicols}                       # 18
                                      # 19

\begin{multicols}{2} does not allow markdown’s sharp symbol. In order to tolerate captions inside a multi-column environment, the command must be redefined and used as a command without any parameters (example (13) with the listing ?? on the page )[36].

4.8 No hyphenation

After the following command, no hyphenation takes place:

\hyphenpenalty=10000    # 1
                        # 2

4.9 Chinese characters

In order to display Chinese characters an appropriate main and mono font must be set in preamble.\(\mathrm{ \TeX }\).[39] lists suitable fonts, for example:

\setCJKmonofont{Noto Sans Mono CJK SC}    # 1
                                          # 2

That font wasn’t available in my system, so i installed it:

sudo apt install fonts-noto-cjk    # 1
                                   # 2

After that, i was looking for Chinese fonts:

fc-list :lang=zh    # 1
                    # 2

That resulted with:

/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK HK:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK KR:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK KR:style=Regular
/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf: Droid Sans Fallback:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK SC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK HK:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK JP:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK HK:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK KR:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK JP:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK HK:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK SC:style=Bold

where i chose render_font(text = "Noto Sans Mono CJK SC") from, the way as pointed out in[40].

4.10 Units

For units, there’s the package siunitx that only works for PDF output. As it does some automation i like to use it. It keeps the spacing between the scalar and its unit smaller than around it. However, there’s no working implementation for MathJax that translates between \(\mathrm{ \LaTeX{} }\) and HyperText Markup Language (HTML).

The examples (15-22) show how to use a quantity consisting out of a scalar and unit.

  1. \qty{5}{\percent} \ce{K2Cr2O7}

  1. \qty{120}{\degree}

  1. \qty{40.5}{\cm}.

.

  1. \qty{1}{\ml}.

.

  1. \qty{14417}{\Hz}.

.

  1. Kuusnurkset alfat saab konverteerida mehhaaniliselt beetaks ja beeta taastub alfaks, kui seda kuumutada kõrgemal temperatuuril kui $\qty{1273,15}{\K}$.

Kuusnurkset alfat saab konverteerida mehhaaniliselt beetaks ja beeta taastub alfaks, kui seda kuumutada kõrgemal temperatuuril kui \(\qty{1273,15}{\K}\).

  1. Lisasime katseklaasi ~$\qty{0,05}{\g}$ lahustatavat ainet (spaatli/pipeti otsatäis).

Lisasime katseklaasi ~\(\qty{0,05}{\g}\) lahustatavat ainet (spaatli/pipeti otsatäis).

  1. Miks katsetes 3.4 ja 3.5 lahuse värvus ei muutunud (vähemalt $\qty{1}{\min}$ kestel)?

Miks katsetes 3.4 ja 3.5 lahuse värvus ei muutunud (vähemalt \(\qty{1}{\min}\) kestel)?

The example (23) shows additionally how to display just a scalar.

  1. Juhendis on esitatud, et selle aine molaarne ekstinktsioonitegur lainepikkuse $\qty{330}{\nm}$ juures on $\num{34300}$.

Juhendis on esitatud, et selle aine molaarne ekstinktsioonitegur lainepikkuse \(\qty{330}{\nm}\) juures on \(\num{34300}\).

The example (24) shows how to show the quantity the qualitative way.

  1. \num{5}-\unit{\percent} \ce{CuSO4} lahust.

- lahust.

The example (25) shows how to use a numeric product as a measurement.

  1. Minu näites tahan ma teada kataloogis *~/eclipse-workspace/test2* asuva faili *children-computers.jpg* omadusi. Näeme, et selle faili tihedus on $\numproduct{96 x 96}$ dpi ja mõõdud on $\numproduct{668 x 371}$ px.

Minu näites tahan ma teada kataloogis ~/eclipse-workspace/test2 asuva faili children-computers.jpg omadusi. Näeme, et selle faili tihedus on \(\numproduct{96 x 96}\) dpi ja mõõdud on \(\numproduct{668 x 371}\) px.

The examples (26-27) show (additionally) how to use a quantity range.

  1. Standardtasu, kui pole ahvatlevamat ettepanekut, on $\num{40} \frac{\epsilon}{\unit{\hour}}$ ja tavaliselt tegutseme $\qty{1.5}{\hour}$ järjest tehes iga tund $\qtyrange{5}{15}{\min}$ silmadele ja mõistusele pause.

Standardtasu, kui pole ahvatlevamat ettepanekut, on \(\num{40} \frac{\epsilon}{\unit{\hour}}\) ja tavaliselt tegutseme \(\qty{1.5}{\hour}\) järjest tehes iga tund \(\qtyrange{5}{15}{\min}\) silmadele ja mõistusele pause.

  1. Alkoholi olemasolu puhul muutub kroomisegu oranž värvus $\qtyrange{2}{3}{\second}$ kestel roheliseks.

Alkoholi olemasolu puhul muutub kroomisegu oranž värvus \(\qtyrange{2}{3}{\second}\) kestel roheliseks.

Some units have subunits on different floors (examples (28-30)).

  1. \unit{\mole\per\cubic\meter}.

  2. \unit{\kg\per\mol}.

  3. õpetaja siiski ütles, et ühik oli hoopis $\unit{\l\per\mol\per\cm}$.

.

.

õpetaja siiski ütles, et ühik oli hoopis \(\unit{\l\per\mol\per\cm}\).

The example (31) additionally shows how to incorporate measurement uncertainty.

  1. $\qty{56,08 \pm 0,07}{\degreeCelsius}$.

\(\qty{56,08 \pm 0,07}{\degreeCelsius}\).

For including R’s values for qty, they need to be converted into characters as shown in the example (32).

  1. Valguse kiirus vaakumis[41(p. 127)].

    speed_of_light_in_vacuum <- 299792458  # 1
    \begin{align}                                                   # 1
    c = \qty{`r as.character(speed_of_light_in_vacuum)`}{\m\per\s}  # 2
    (\#eq:speed-of-light-in-vacuum)                                 # 3
    \end{align}                                                     # 4
                                                                    # 5
\[\begin{align} c = \qty{299792458}{\m\per\s} \tag{4.1} \end{align} \]

Some quantities are not present in siunitx, for instance the short for year in Estonian - “a”.

The example (33) shows how the decimal point if the unit is and it is the smallest unit is not retained[42].

  1. Pean valmistama vesilahust, mis sisaldab massiprotsenti .

Pean valmistama vesilahust, mis sisaldab massiprotsenti .

The example (34) shows how to retain the decimal point if the unit is and it is the smallest unit.

  1. Pean valmistama vesilahust, mis sisaldab massiprotsenti .

Pean valmistama vesilahust, mis sisaldab massiprotsenti .

4.11 Equations

4.11.1 Introduction

Equations can be used in math mode, id est either between $ or \[ and \]. i prefer the bug signs.

4.11.2 Text

In order to display the text in roman, i use \text:

\text{d}  # 1
          # 2

\[\text{d}\]

4.11.3 Subscript

Subscript can be used with _:

t_\text{d}  # 1
            # 2

\[t_\text{d}\]

4.11.4 Superscript

10^3  # 1
      # 2

\[10^3\]

4.11.5 Vector

For one-letter-vectors:

\vec{F}  # 1
         # 2

\[\vec{F}\]

For multiple-letter-vectors:

\overrightarrow{\frac{E \cdot Q}{\mathrm{d}(s)}}  # 1
                                                  # 2

\[\overrightarrow{\frac{E \cdot Q}{\mathrm{d}(s)}}\]

4.11.6 Multiplication

i like to use the dot for a comma. If there are decimals inside the equation according to rules of System Internationale des Unités cross must be used instead of dot:

C_i \times (t + 273.15)^{i - 9}  # 1
                                 # 2

\[C_i \times (t + 273.15)^{i - 9}\]

Otherwise, a center dot is a better solution as cross symbolises vector multiplication as well:

m \cdot \vec{a}  # 1
                 # 2

\[m \cdot \vec{a}\]

4.11.7 Fraction

\frac regulates the height of the expression, so that an inline expression has the height of the text line and a block expression has a higher height[43, lk 122]. \tfrac always renders the expression to have the height of the inline text. \dfrac always renders the expression to have a higher and better readable height. The examples can be seen in the code block ?? on the page .

4.11.8 Functions

As functions must be written in roman then:

$\mathrm{ln}(T)$  # 1
                  # 2

\[\mathrm{ln}(T)\]

4.11.9 Sum

\sum_{i := 8}^{n}{C_i}  # 1
                        # 2

\[\sum_{i := 8}^{n}{C_i}\]

4.11.10 Aligning

It’s reasonable to align all the tables:

\begin{align}                                                                                                         # 1
\frac{R_{sisemine}}{(R + R_{sisemine})^2} &= 0, R \nequal R_{sisemine} (\#eq:extrema-of-eta-R-initial)\leavevmode\\   # 2
R_{sisemine} &= 0                                                                                                     # 3
(\#eq:extrema-of-eta-R)                                                                                               # 4
\end{align}                                                                                                           # 5
                                                                                                                      # 6
\[\begin{align} \frac{R_{sisemine}}{(R + R_{sisemine})^2} &= 0, R \nequal R_{sisemine} \tag{4.2}\leavevmode\\ R_{sisemine} &= 0 \tag{4.3} \end{align} \]

Here, \\ and line break means a real line break.

Additional labels must be placed in the end of the corresponding row just before the double slashes before the line break. Additional labels are displayed on the web page however not linked.

Referencing an equation is also visible in the equation (4.2):

\@ref(eq:extrema-of-eta-R-initial)  # 1
                                    # 2

Empty lines aren’t allowed.

4.11.11 Calculus

\partial{H}  # 1
             # 2

\[\partial{H}\]

4.11.12 Cancelling

\begin{align}                                                                                                                                                                                                                                # 1
`r if (knitr::is_html_output()) { "\\require{cancel}" }`\frac{\frac{\mathrm{\frac{L^2 \cdot \cancel{M}}{T^2}}}{\mathrm{\cancel{N}} \cdot \Theta}}{\mathrm{\frac{\cancel{M}}{\cancel{N}}}} = \frac{\mathrm{L^2}}{\mathrm{T^2} \cdot \Theta},  # 2
(\#eq:dimensional-analysis-for-specific-gas-constant)                                                                                                                                                                                        # 3
\end{align}                                                                                                                                                                                                                                  # 4
                                                                                                                                                                                                                                             # 5
\[\begin{align} \require{cancel}\frac{\frac{\mathrm{\frac{L^2 \cdot \cancel{M}}{T^2}}}{\mathrm{\cancel{N}} \cdot \Theta}}{\mathrm{\frac{\cancel{M}}{\cancel{N}}}} = \frac{\mathrm{L^2}}{\mathrm{T^2} \cdot \Theta}, \tag{4.4} \end{align} \]

4.11.13 Underbrace

\underbrace{c_p \cdot (T_\text{out} - T_\text{d})}_{\text{mõistlik soojuskadu õhus}}  # 1
                                                                                      # 2

\[\underbrace{c_p \cdot (T_\text{out} - T_\text{d})}_{\text{mõistlik soojuskadu õhus}}\]

4.11.14 Integral

\int{\overrightarrow{\frac{E \cdot Q}{\mathrm{d}(s)}}} \cdot \mathrm{d}(s).  # 1
                                                                             # 2

\[\int{\overrightarrow{\frac{E \cdot Q}{\mathrm{d}(s)}}} \cdot \mathrm{d}(s).\]

4.11.15 Percent

\%.  # 1
     # 2

\[\%.\]

4.11.16 Comparison

p \ll .05.  # 1
            # 2

\[p \ll .05.\]

4.11.17 Greek letters

$$\Delta, \epsilon, \eta, \nu.$$  # 1
                                  # 2

\[\Delta, \epsilon, \eta, \nu.\]

4.11.18 Matrices

Avaldisena (4.5) leheküljel on esitatud kolme vektori ristkorrutis[25(lk A-7)],[44].

\[\begin{align} \vec{V_1} \times (\vec{V_2} \times \vec{V_3}) = \vec{V_1} \times \begin{vmatrix} \vec{i}&\vec{j}&\vec{k}\leavevmode\\ V_{2; x}&V_{2; y}&V_{2; z}\leavevmode\\ V_{3; x}&V_{3; y}&V_{3; z} \end{vmatrix} \tag{4.5} \end{align}\]

4.11.19 Proportionality

The symbol for proportionality is \(\propto\) and it can be used as shown in the listing ?? on the page[33, lk 151].

4.11.20 Mean

The command for the mean symbol is \overline and it can be used as shown in the listing ?? on the page[33, lk 164].

4.12 Text

4.12.1 Non-breaking space

Without a non-breaking space:

Joonistan Lewise skeemi, millele on märgitud ainult elektronid, mitte elemendi sümbol.  # 1
                                                                                        # 2

Joonistan Lewise skeemi, millele on märgitud ainult elektronid, mitte elemendi sümbol.

With a non-breaking space[45]:

Joonistan Lewise skeemi, millele on märgitud ainult elektronid, mitte elemendi\nobreakspace{}sümbol.  # 1
                                                                                                      # 2

Joonistan Lewise skeemi, millele on märgitud ainult elektronid, mitte elemendisümbol.

4.12.2 Colour

$$\color{red}{\text{Augusti psühhomeetriga}}.$$  # 1
                                                 # 2

\[\color{red}{\text{Augusti psühhomeetriga}}.\]

4.12.3 Size

$$\huge{\text{Augusti psühhomeetriga}}$$  # 1
                                          # 2

\[\huge{\text{Augusti psühhomeetriga}}\]

4.12.4 Typewriter

Inline code can be written using \texttt as seen in the code block ?? on the page[33, lk 23].

4.12.5 Code blocks

Code blocks can be written using the package listings[46] that can be configured in preamble.tex as seen in the listing ?? on the page .

An example with listings is shown in the listing ?? on the page .

The usage of this new environment can be seen in the listing ?? on the page .

4.12.6 Line breaks

An example of how to force a line break is shown in the listing ?? on the page[31, lk 271].

4.12.7 Symbols

The examples (35-36) show how to use some symbols as text[47(lk 186)]. The package fontawesome5 is needed for them.

  1. \faHandPointRight

  2. \faHandPointDown

4.12.8 Superscript

The example (38) with the listing ?? on the page shows how to use a superscript outside the math mode[48].

4.13 Chemistry

4.13.1 Chemical symbols

For using the package mhchem, it has to be installed[49]:

sudo apt install texlive-science  # 1
                                  # 2

After that, mchem can be used:

`r if (knitr::is_html_output()) { "\\require{mhchem}" }`\ce{N_2}  # 1
                                                                  # 2

\[\require{mhchem}\ce{N_2}\]

Puidu ja arheoloogiliste proovide dateerimiseks kasutatakse $\ce{^{14}C}$'d, mille poolestusaeg on 5715 a.  # 1
                                                                                                            # 2

Puidu ja arheoloogiliste proovide dateerimiseks kasutatakse \(\ce{^{14}C}\)’d, mille poolestusaeg on 5715 a.

The use with an arrow is shown in the equation

\begin{align}                                                                                                           # 1
\color{green}{5}\ce{Na}\color{green}{\ce{Cl}}\ce{O2} + \color{blue}{4}\ce{H}\color{blue}{\ce{Cl}} \ce{->}\leavevmode\\  # 2
\color{blue}{\ce{4Cl}}\ce{O2} + \color{green}{5}\ce{Na}\color{green}{\ce{Cl}} + \ce{2H2O}                               # 3
(\#eq:ce-with-arrow)                                                                                                    # 4
\end{align}                                                                                                             # 5
                                                                                                                        # 6

\[\begin{align} \color{green}{5}\ce{Na}\color{green}{\ce{Cl}}\ce{O2} + \color{blue}{4}\ce{H}\color{blue}{\ce{Cl}} \ce{->}\leavevmode\\ \color{blue}{\ce{4Cl}}\ce{O2} + \color{green}{5}\ce{Na}\color{green}{\ce{Cl}} + \ce{2H2O} \tag{4.6} \end{align}\]

Aldehüüd on redutseerija ja redutseerib komplekseeritud vask(II)iooni  # 1
vask(I)oksiidiks:                                                      # 2
                                                                       # 3
$$\ce{2Cu^2+}_\text{complexed}\ce{+2[OH]- + 2e- -> Cu2O + H2O}.$$      # 4
                                                                       # 5

Aldehüüd on redutseerija ja redutseerib komplekseeritud vask(II)iooni vask(I)oksiidiks:

\[\ce{2Cu^2+}_\text{complexed}\ce{+2OH- + 2e- -> Cu2O + H2O}.\]

4.13.2 Electron configuration

For automatically displaying electron configuration, one can use the package elements[50].

Electron configuration for carbon which is the sixth element in the periodic system of chemical elements:

\elconf{6}  # 1
            # 2

4.13.3 Orbital energy level diagram

For generating orbital energy level diagrams, one can use the package modiagram[51]. It only works up to the second energy level.

This is how to display an orbital energy levels diagram for carbon:

                                           # 1
\begin{modiagram}[style = square, labels]  # 2
    \atom{left}{1s, 2s, 2p = {; up, up}}   # 3
    \EnergyAxis[title]                     # 4
\end{modiagram}                            # 5
                                           # 6

It’s still possible to hack in the third levels’ s- and p-levels but not further levels as seen for sulfur:

                                                                                                               # 1
\begin{modiagram}[style = square, labels]                                                                      # 2
    \atom{left}{1s, 2s, 2p}                                                                                    # 3
    \AO{s}[label = {3s}]{6; pair}                                                                              # 4
    \AO{p}[label[x] = $3\mathrm{p}_x$, label[y] = $3\mathrm{p}_y$,label[z]= $3\mathrm{p}_z$]{8; pair, up, up}  # 5
    \EnergyAxis[title]                                                                                         # 6
\end{modiagram}                                                                                                # 7
                                                                                                               # 8

4.13.4 Lewis dot diagram

For generating Lewis dot diagrams, one can use the package chemfig[52].

This is how to display the Lewis dot diagram for sulfur using angles:

\Charge{0 = \:, 90 = \:, 180 = \., 270 = \.}{S}  # 1
                                                 # 2

4.13.5 Molecular schemas

chemfig is useful for drawing molecular schemas as seen in the schema (4.7) on the page .

\begin{align}                                 # 1
\chemfig{                                     # 2
    H-[:30]                                   # 3
    O-[:-30]                                  # 4
    -[:30](-[:90]O-[:150]H)                   # 5
    -[:-30](=[:-90]O)                         # 6
    -[:30]                                    # 7
    O(-[:90]H)                                # 8
    -[:-30,,,,dash pattern=on 1pt off 1pt]    # 9
    Cu-[:30,,,,dash pattern=on 1pt off 1pt]  # 10
    O(-[:90]H)                               # 11
    -[:-30](=[:-90]O)                        # 12
    -[:30](-[:90]O-[:30]H)                   # 13
    -[:-30]                                  # 14
    -[:30]                                   # 15
    O-[:-30]                                 # 16
    H                                        # 17
}                                            # 18
(\#eq:copper-glycerate)                      # 19
\end{align}                                  # 20
                                             # 21
[@pubchem_copper].                           # 22
                                             # 23
\[\begin{align} \chemfig{ H-[:30] O-[:-30] -[:30](-[:90]O-[:150]H) -[:-30](=[:-90]O) -[:30] O(-[:90]H) -[:-30,,,,dash pattern=on 1pt off 1pt] Cu-[:30,,,,dash pattern=on 1pt off 1pt] O(-[:90]H) -[:-30](=[:-90]O) -[:30](-[:90]O-[:30]H) -[:-30] -[:30] O-[:-30] H } \tag{4.7} \end{align} \]

[53].

A more complicated molecular diagram is represented as the schema (4.8) on the page .

\begin{align}                                                                                                                                                                                                                                   # 1
\chemfig{                                                                                                                                                                                                                                       # 2
\underbrace{\chemfig{H-[:180]O-[:180]-[:-90](-[:-90]-O(-[:30,,,,dash pattern=on 1pt off 1pt])-[:-90]H)-O-[:-30]Cu-[:-30]O-(-[:90]-[:180]O(-[:-150,,,,dash pattern=on 1pt off 1pt])-[:90]H)-[:-90]-[:180]O-[:180]H}}_\text{vask(II)glütseraat}.  # 3
(\#eq:Cu-II-glycerate)                                                                                                                                                                                                                          # 4
\end{align}                                                                                                                                                                                                                                     # 5
                                                                                                                                                                                                                                                # 6
\[\begin{align} \underbrace{\chemfig{H-[:180]O-[:180]-[:-90](-[:-90]-O(-[:30,,,,dash pattern=on 1pt off 1pt])-[:-90]H)-O-[:-30]Cu-[:-30]O-(-[:90]-[:180]O(-[:-150,,,,dash pattern=on 1pt off 1pt])-[:90]H)-[:-90]-[:180]O-[:180]H}}_\text{vask(II)glütseraat}. \tag{4.8} \end{align} \]
Vesi ja hüdroksübenseen (fenool [@haynes_2014_crc, p. 3-446], $\chemfig{*6(-=-=(-OH)-=)}\qquad$ [@haynes_2014_crc, p. 3-447], tsükloalkeen) omavahel ei lahustu, sest hüdrofoobseid süsinikke on võrdlemisi palju.  # 1
                                                                                                                                                                                                                    # 2

Vesi ja hüdroksübenseen (fenool[25(pp. 3–446)], \(\chemfig{*6(-=-=(-OH)-=)}\qquad\)[25(pp. 3–447)], tsükloalkeen) omavahel ei lahustu, sest hüdrofoobseid süsinikke on võrdlemisi palju.

1,3-benseendiool ($\chemfig{*6(-=(-\ce{OH})-=(-\ce{OH})-=)}$, resortsiin `r render_with_emojis(text = "(ref:haynes-2014-crc), p. 3-480")`).  # 1
                                                                                                                                             # 2

1,3-benseendiool (\(\chemfig{*6(-=(-\ce{OH})-=(-\ce{OH})-=)}\), resortsiin[25(pp. 3–480)]).

Hüdroksübenseen reageeris raudkloriidiga niimoodi:                              # 1
                                                                                # 2
$$\ce{3} \chemfig{*6(-=-=(-\ce{OH})-=)} \ce{+ FeCl3 ->}                         # 3
\chemfig{                                                                       # 4
    *6(-=-(-O-[:30]Fe(-[:90]O(-[:90]*6(-=-=-=)))-[:-30]O-[:-30]*6(-=-=-=))=-=)  # 5
}                                                                               # 6
\ce{+ 3HCl}.$$                                                                  # 7
                                                                                # 8

Hüdroksübenseen reageeris raudkloriidiga niimoodi:

\[\ce{3} \chemfig{*6(-=-=(-\ce{OH})-=)} \ce{+ FeCl3 ->} \chemfig{ *6(-=-(-O-[:30]Fe(-[:90]O(-[:90]*6(-=-=-=)))-[:-30]O-[:-30]*6(-=-=-=))=-=) } \ce{+ 3HCl}.\]

4.14 Physics

Current diagrams are only shown in the print form. For a current diagram, i need to add the following line into preamble.tex:

\usepackage{circuitikz}  # 1
                         # 2
                                                                  # 1
\begin{figure}                                                    # 2
\begin{circuitikz}[european]                                      # 3
    \draw                                                             # 4
    (0, 0)  to[dcvsource, l = $E$, v_ = $r$] (0, 2)                     # 5
            to[ammeter] (2, 2)                                                # 6
            to[vR, l = $R$, *-*] (2, 0) -- (0, 0);                            # 7
    \draw                                                             # 8
        (2, 2)  to[voltmeter] (4, 2) -- (4, 0) -- (2, 0)                    # 9
    ;                                                                # 10
\end{circuitikz}                                                 # 11
  \caption{Skeem, mille järgi toimetasime.} \label{fig:schema}   # 12
\end{figure}                                                     # 13
                                                                 # 14

4.15 New page

The following snippet is the code for a page break:

\newpage  # 1
          # 2

If the new page must be empty then the following code snippet is useful:

\newpage    # 1
\mbox{}     # 2
\pagebreak  # 3
            # 4

4.16 Blanks

For scaffolding, one needs to have these rows in preamble.tex[54]:

% for fill-in-the-gaps-tests                                  # 1
\newlength{\blankwidth}                                       # 2
\newcommand{\blank}[1]{%                                      # 3
    \ifmmode\settowidth{\blankwidth}{\ensuremath{{#1}{#1}{#1}}}%  # 4
    \else\settowidth{\blankwidth}{{#1}{#1}{#1}}%                  # 5
    \fi                                                           # 6
    \makebox[\blankwidth]{\dotfill}}                              # 7
                                                              # 8

Then, you can use blank:

Täna on 2023-12-12 ja mina olen \blank{10. Trubilko, Vladislav}.  # 1
                                                                  # 2

The output looks like:

Täna on 2023-12-12 ja mina olen .

4.17 Lists

Märgista omadus, kui see on keemiline: