In Frank Mittelbach's answer here, he constructs an environment to add linebreak in a \raisebox
-like environment.
In Alain Matthes' answere here, he shows how to get a consistent row height in a table.
Question
I would like to combine these two answers to get a \raisebox
-like environment where the row height is consistent throughout the table, at the same time.
How do I do that?
Update
Here is an example with Frank's code:
\documentclass[
a4paper,
12pt,
danish
]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[
hmargin = 1cm,
vmargin = 1.5cm
]{geometry}
\usepackage{ragged2e,array}
\usepackage{microtype}
% we need space, -, and newline active and set to some commands
{\obeyspaces
\catcode`\^^M\active%
\catcode`\-\active%
\gdef\setraisedtextactivedef#1#2{\let =#1\let^^M=#1\let-=#2}}
\newbox\raisedtextbox
% main action is to collect material into a box
\def\collectraisedtext{\setbox\raisedtextbox\hbox\bgroup\raisedtextstyle
\gobbleactivespaces}
% and if we want we can use a special style
\def\raisedtextstyle{\textnormal}
% at a space end collection, typeset and restart
\def\raisedtextspace{\egroup
\X{\box\raisedtextbox}%
\space
\collectraisedtext
}
% at \- end colloection, typeset, add discretionary and restart
\def\raisedtextbreak{\egroup\X{\box\raisedtextbox}\discretionary{\X-}{}{}\collectraisedtext}
% at - (explicit hyphen) more or less the same
\def\raisedtexthyphen{\egroup\X{\box\raisedtextbox}\discretionary{\X-}{}{\X-}\collectraisedtext}
% several active spaces (or newlines) would do harm ...
\def\gobbleactivespaces{\futurelet\next\gobbleactivespacesX}
\def\gobbleactivespacesX{%
\ifx\next\raisedtextspace
\expandafter\gobbleactivespacesXX
\fi
}
\def\gobbleactivespacesXX#1{\gobbleactivespaces}
% putting all together
\newenvironment{raisedtext}[1][-0.75ex]
{%
\def\X##1{\raisebox{#1}{##1}}%
\obeyspaces
\catcode`\^^M\active
\catcode`\-\active
\setraisedtextactivedef\raisedtextspace\raisedtexthyphen
\let\-\raisedtextbreak
\collectraisedtext
}{%
% at end environment, end collection and typeset (if not empty).
% Otherwise remove space already inserted before that collection
\egroup
\ifdim\wd\raisedtextbox>0pt % weak prove that this is not empty
\X{\box\raisedtextbox}%
\else
\unskip
\fi
}
\DisableLigatures[f]{encoding = T1}
\pagestyle{empty}
\begin{document}
\bfseries
\begin{tabular}{
*{4}{|>{\RaggedRight\arraybackslash}m{0.2\textwidth}}|
}
\hline
Konventionelt landbrug
& Landbrug, hvor det er tilladt at bruge sprøjtegifte og kunstgøding
& Økologisk landbrug
& \begin{raisedtext}
Landbrug, der drives med bedre forhold for dyrene og uden brug af sprøjtegifte og kunstgødning på markerne
\end{raisedtext} \\[1.5ex]
\hline
Kunstgødning
& Gødning, der er fremstillet på en fabrik
& Gylle
& \begin{raisedtext}
Urin og afføring fra husdyr, der er flydende
\end{raisedtext} \\[1.5ex]
\hline
\end{tabular}
\end{document}
How do I (automatically) get an even row height in this table?
\X
from one answer in an entry defined by theC
column type of the other? – David Carlisle Mar 17 '16 at 11:20:-(
Will you please create a complete answer for me? – Svend Tveskæg Mar 17 '16 at 11:43