2

Consider the following code:

\DocumentMetadata{} \documentclass[ a4paper, 12pt, danish ]{article} \usepackage{fontspec} \setmainfont[ NFSSFamily = tgp, Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic, Ligatures = { TeX, CommonOff } ]{texgyrepagella} \usepackage[ math-style = TeX ]{unicode-math} \setmathfont{texgyrepagella-math.otf} \setmathfont[ version = bold, FakeBold = 4 ]{texgyrepagella-math.otf} \DeclareSymbolFont{textdigits}{TU}{tgp}{m}{n} \SetSymbolFont{textdigits}{bold}{TU}{tgp}{b}{n} \Umathcode`0="7 \symtextdigits `0 \Umathcode`1="7 \symtextdigits `1 \Umathcode`2="7 \symtextdigits `2 \Umathcode`3="7 \symtextdigits `3 \Umathcode`4="7 \symtextdigits `4 \Umathcode`5="7 \symtextdigits `5 \Umathcode`6="7 \symtextdigits `6 \Umathcode`7="7 \symtextdigits `7 \Umathcode`8="7 \symtextdigits `8 \Umathcode`9="7 \symtextdigits `9 \usepackage{polyglossia} \setdefaultlanguage{danish} \usepackage[ hmargin = 2.4cm, vmargin = 3cm ]{geometry} \usepackage{ multirow, array } \usepackage{siunitx} \usepackage{pst-eucl} \sisetup{ locale = DE } \psset{ dimen = m, PointSymbol = none, PointName = none, MarkAngleRadius = 0.25, RightAngleSize = 0.2, LabelSep = -0.3 } \def\mlr{1} \newcommand*\saenk[1]{\raisebox{\fpeval{-5/9*\mlr}ex}{#1}} \newcommand*\nyLinje[2][c]{\begin{tabular}[#1]{@{}l@{}}#2\end{tabular}} \begin{document} \begin{center} \bfseries {\fontsize{30}{36}\selectfont Retvinklede trekanter}\\[1ex] {\fontsize{20}{24}\selectfont (Pythagoras og trigonometri)} \end{center} \vspace{\fill} \begin{alignat*}{2} &\text{Pythagoras:}&\qquad a^{2} + b^{2} &= c^{2}\\ &\text{Trigonometri:}& \sin(v) &= \frac{\text{modstående karate}}{\text{hypotenusen}}\\ &\text{Trigonometri:}& \cos(v) &= \frac{\text{hosliggende karate}}{\text{hypotenusen}}\\ &\text{Trigonometri:}& \tan(v) &= \frac{\text{modstående katete}}{\text{hosliggende katete}} \end{alignat*} \vspace{\fill} \begin{center} \begin{tabular}{ |p{4.95cm}| >{\centering\arraybackslash}p{4.95cm}| >{\centering\arraybackslash}p{4.95cm}| } \hline \multicolumn{1}{|c|}{\multirow{2}{*}{\raisebox{\fpeval{-1.2*\mlr}ex}{Du kender \dots}}} & \multicolumn{2}{ c|}{\saenk{Du kan beregne \dots}} \\[\mlr ex] \cline{2-3} & \saenk{sider} & \saenk{vinkler} \\[\mlr ex] \hline Siderne~$a$ og~$b$\hspace*{2em}% \raisebox{\fpeval{-4.5*\mlr}ex}{% \begin{pspicture}(0,-0.38)(1.33,1.5) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstRightAngle{B}{C}{A} \uput{0.1}[315](C){$C$} {\psset{ linestyle = none } \pcline[offset = 6pt](B)(C) \ncput{$a$} \pcline[offset = 7pt](C)(A) \ncput{$b$}} \end{pspicture}} & $c = \sqrt{a^{2} + b^{2}}$ & \parbox{4cm}{\vspace*{-1ex}\begin{align*} A &= \tan^{-1}{\mkern -7mu}\left(\frac{a}{b}\right){\mkern -7mu}\\ B &= \tan^{-1}{\mkern -7mu}\left(\frac{b}{a}\right){\mkern -7mu} % \\ &= \ang{90} - A \end{align*}\vspace*{-1ex}} \\[\mlr ex] \hline Siderne~$a$ og~$c$\hspace*{2.06em}% \raisebox{\fpeval{-4.5*\mlr}ex}{% \begin{pspicture}(0,-0.35)(1.33,1.5) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstRightAngle{B}{C}{A} \uput{0.1}[315](C){$C$} {\psset{ linestyle = none } \pcline[offset = 6pt](B)(C) \ncput{$a$} \pcline[offset = 6pt](A)(B) \ncput{$c$}} \end{pspicture}} & $b = \sqrt{c^{2} - a^{2}}$ & \parbox{4cm}{\begin{align*} A &= \sin^{-1}{\mkern -7mu}\left(\frac{a}{c}\right){\mkern -7mu}\\ B &= \cos^{-1}{\mkern -7mu}\left(\frac{a}{c}\right){\mkern -7mu} % \\ &= \ang{90} - A \end{align*}} \\[\mlr ex] \hline Siderne~$b$ og~$c$\hspace*{2.05em}% \raisebox{\fpeval{-4.5*\mlr}ex}{% \begin{pspicture}(0,-0.38)(1.33,1.5) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstRightAngle{B}{C}{A} \uput{0.1}[315](C){$C$} {\psset{ linestyle = none } \pcline[offset = 7pt](C)(A) \ncput{$b$} \pcline[offset = 6pt](A)(B) \ncput{$c$}} \end{pspicture}} & $a = \sqrt{c^{2} - b^{2}}$ & \parbox{4cm}{\vspace*{-1ex}\begin{align*} A &= \cos^{-1}{\mkern -7mu}\left(\frac{b}{c}\right){\mkern -7mu}\\ B &= \sin^{-1}{\mkern -7mu}\left(\frac{b}{c}\right){\mkern -7mu} % \\ &= \ang{90} - A \end{align*}\vspace*{-1ex}} \\[\mlr ex] \hline \raisebox{\fpeval{-0.3*\mlr}ex}{\nyLinje[l]{Siden~$a$ og\\ vinklen~$A$}}% \hspace*{2.71em}% \raisebox{\fpeval{-4.5*\mlr}ex}{% \begin{pspicture}(-0.38,-0.35)(1.33,1.5) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstMarkAngle{C}{A}{B}{$A$} \pstRightAngle{B}{C}{A} \uput{0.1}[315](C){$C$} {\psset{ linestyle = none } \pcline[offset = 6pt](B)(C) \ncput{$a$}} \end{pspicture}} & \parbox{4cm}{\begin{align*} b &= \frac{a}{\tan(A)}\\ c &= \frac{a}{\sin(A)} \end{align*}} & \parbox{4cm}{\begin{equation*} B = \ang{90} - A \end{equation*}} \\[\fpeval{\mlr+3.5} ex] \hline \raisebox{\fpeval{-0.6*\mlr}ex}{\nyLinje[c]{Siden~$a$ og\\ vinklen~$B$}}% \hspace*{3.61em}% \raisebox{\fpeval{-5.3*\mlr}ex}{% \begin{pspicture}(0,-0.33)(1.33,1.95) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstMarkAngle{A}{B}{C}{$B$} \pstRightAngle{B}{C}{A} \uput{0.1}[330](C){$C$} {\psset{ linestyle = none } \pcline[offset = 6pt](B)(C) \ncput{$a$}} \end{pspicture}} & \parbox{4cm}{\begin{align*} b &= a \cdot \tan(B)\\ c &= \frac{a}{\cos(B)} \end{align*}} & \raisebox{\fpeval{-0.3*\mlr}ex}{\parbox{4cm}{\begin{equation*} A = \ang{90} - B \end{equation*}}} \\[\fpeval{\mlr+3.5} ex] \hline \end{tabular} \end{center} \vspace*{-1.5ex} \hspace*{\fill} \emph{fortsættes på næste side \dots} \newpage \noindent \emph{\dots{} fortsat fra sidste side} \vspace*{-3ex} \begin{center} \begin{tabular}{ |p{4.96cm}| >{\centering\arraybackslash}p{4.96cm}| >{\centering\arraybackslash}p{4.96cm}| } \hline \multicolumn{1}{|c|}{\multirow{2}{*}{\raisebox{\fpeval{-1.2*\mlr}ex}{Du kender \dots}}} & \multicolumn{2}{ c|}{\saenk{Du kan beregne \dots}} \\[\mlr ex] \cline{2-3} & \saenk{sider} & \saenk{vinkler} \\[\mlr ex] \hline \raisebox{\fpeval{-0.2*\mlr}ex}{\nyLinje[c]{Siden~$b$ og\\ vinklen~$A$}}% \hspace*{3.59em}% \raisebox{\fpeval{-4*\mlr}ex}{% \begin{pspicture}(0,-0.33)(1.33,1.5) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstMarkAngle{C}{A}{B}{$A$} \pstRightAngle{B}{C}{A} \uput{0.1}[330](C){$C$} {\psset{ linestyle = none } \pcline[offset = 6pt](C)(A) \ncput{$b$}} \end{pspicture}} & \parbox{4cm}{\begin{align*} a &= b \cdot \tan(A)\\ c &= \frac{b}{\cos(A)} \end{align*}} & \raisebox{\fpeval{-0.3*\mlr}ex}{\parbox{4cm}{\begin{equation*} B = \ang{90} - A \end{equation*}}} \\[\fpeval{\mlr+3.5} ex] \hline \raisebox{\fpeval{-0.2*\mlr}ex}{\nyLinje[c]{Siden~$b$ og\\ vinklen~$B$}}% \hspace*{3.59em}% \raisebox{\fpeval{-5*\mlr}ex}{% \begin{pspicture}(0,-0.33)(1.33,1.5) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstMarkAngle{A}{B}{C}{$B$} \pstRightAngle{B}{C}{A} \uput{0.1}[330](C){$C$} {\psset{ linestyle = none } \pcline[offset = 6pt](C)(A) \ncput{$b$}} \end{pspicture}} & \parbox{4cm}{\begin{align*} a &= \frac{b}{\tan(A)}\\ c &= \frac{b}{\sin(B)} \end{align*}} & \raisebox{\fpeval{-0.3*\mlr}ex}{\parbox{4cm}{\begin{equation*} A = \ang{90} - B \end{equation*}}} \\[\fpeval{\mlr+3.5} ex] \hline \raisebox{\fpeval{-0.3*\mlr}ex}{\nyLinje[l]{Siden~$c$ og\\ vinklen~$A$}}% \hspace*{2.75em}% \raisebox{\fpeval{-4.5*\mlr}ex}{% \begin{pspicture}(-0.38,-0.35)(1.33,1.5) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstRightAngle{B}{C}{A} \uput{0.1}[315](C){$C$} \pstMarkAngle{C}{A}{B}{$A$} {\psset{ linestyle = none } \pcline[offset = 6pt](A)(B) \ncput{$c$}} \end{pspicture}} & \parbox{4cm}{\begin{align*} a &= c \cdot \sin(A)\\ b &= c \cdot \cos(A) \end{align*}} & \raisebox{\fpeval{-0.3*\mlr}ex}{\parbox{4cm}{\begin{equation*} B = \ang{90} - A \end{equation*}}} \\[\fpeval{\mlr+3.5} ex] \hline \raisebox{\fpeval{0.5*\mlr}ex}{\nyLinje[l]{Siden~$c$ og\\ vinklen~$B$}}% \hspace*{3.4em}% \raisebox{\fpeval{-5*\mlr}ex}{ \begin{pspicture}(0,-0.4)(1.33,2.15) \small \pstGeonode(0,0){A}(1,1.5){B}(1,0){C} \pspolygon(A)(B)(C) \pstMarkAngle{A}{B}{C}{$B$} \pstRightAngle{B}{C}{A} \uput{0.1}[330](C){$C$} {\psset{ linestyle = none } \pcline[offset = 6pt](A)(B) \ncput{$c$}} \end{pspicture}} & \raisebox{\mlr ex}{\parbox{4cm}{\begin{align*} a &= c \cdot \cos(B)\\ b &= c \cdot \sin(B) \end{align*}}} & \raisebox{\mlr ex}{\parbox{4cm}{\begin{equation*} A = \ang{90} - B \end{equation*}}} \\[\fpeval{\mlr+3.5} ex] \hline \end{tabular} \end{center} \end{document} 

The code more or less produces the desired output, but it is a mess. Problems, I would like help dealing with are the following:

  • How do I automatically left-align the text in the first column and right-align he drawings? (All the manually added space is really ugly.)

  • How do I make all the table cells (except the header) have the same height?

  • How do I color the table header on both pages, say, grey?

Also, I would like a general clean-up of my code, if possible.

4
  • 3
    I feel like this should really be four separate questions. The three bulleted can each be their own, and then a general clean-up might be a fourth. General clean up might end up being off-topic for being too opinion based, though. Commented Sep 29, 2024 at 18:30
  • I agree, there might be separate duplicates for each of the questions, if they are split then we can close each as the relevant duplicate or leave them open and answer them if a subquestion is not answered elsewhere yet. Commented Sep 29, 2024 at 18:47
  • also, the first three at least could be asked with much simpler examples. Commented Sep 29, 2024 at 23:51
  • I've voted to close my questions and have split it up. Commented Sep 30, 2024 at 9:11

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.