3

First: I've split up my question(s) from Cleaning up code and here is one of the bullets, with the code somewhat reduced.

Consider

\DocumentMetadata{} \documentclass[ a4paper, 12pt ]{article} \usepackage[ math-style = TeX ]{unicode-math} \usepackage[ hmargin = 2.4cm, vmargin = 3cm ]{geometry} \usepackage{multirow} \usepackage{pst-eucl} \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} \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} \end{align*}} \\[\mlr ex] \hline \end{tabular} \end{center} \end{document} 

Question

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

4
  • Hmm. They seem the same height to me. Anyway, you can add a kind-of big strut at the start of every row, bigger than the bigger graphics, like \vrule width 0pt height 6cm depth 1cm\relax (clearly hidden with a macro...) Commented Sep 30, 2024 at 9:37
  • Or do you want to make it automatic so that the cell's height is equal to the tallest one? That will be a bit more (euphemism) complex and will require two passes, which will probably break havoc with the MetaData accessibility things... Commented Sep 30, 2024 at 9:45
  • @Rmano I want to make it automatic so that the cell's height is equal to the tallest one, if possible. :-) Commented Sep 30, 2024 at 12:05
  • Hmm. I suspect this will be quite a big job, at least at my skill level. Maybe if you change the question to make the target clearer (for example, set every row height to the one of the tallest row) can stimulate more knowledgeable people... ;-). Also, a much simpler MWE (standard fonts, just a couple of different box, ten lines total) could help... Commented Sep 30, 2024 at 16:42

1 Answer 1

2

As discussed in the comments, having the row height set automatically to the tallest one is quite daunting... although I can envisage a strategy, I do not think I can solve it in a reasonable time. For the time being, I'll show the idea of how I would do it manually. Just add a strut big enough (and balance height and depth so that you have your preferred vertical alignment).

This is not your example, just a minimal one, but I think it is better to "center" the question on the core matter. If there were an easy way to measure the natural row height, one could use a couple of passes (through the .aux file) to automatically choose the strut size... (*)

\documentclass[]{article} \usepackage{graphicx} \usepackage{adjustbox} \newcommand{\bigstrut}{\vrule width 0pt height 1cm depth 1cm\relax} \renewcommand{\arraystretch}{1.2} \begin{document} \begin{tabular}{|c|c|c|} \hline headline & headline & headline \\ \hline \bigstrut first row & A & B \\ \hline \bigstrut second row & \adjincludegraphics[height=1.5cm, valign=M]{example-image-a} & C \\ \hline \end{tabular} \end{document} 

enter image description here


(*) yes, this is a bait /me ducks

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.