我希望乳胶忽略表格单元格的高度并将其内容溢出到表格单元格的上方和下方(见图片 - 红色箭头)。首先,我尝试了 \multirow,但这无法以正确的方式将文本对齐到左侧。
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{multirow}
\begin{document}
%%- Cropped Image
\newcommand{\croppedimg}[1]%
{%
\adjustbox{valign=c}{\includegraphics[width=1\linewidth,clip=true,trim=90pt 60pt 50pt 140pt]{#1}}%
}%
\begin{minipage}[t]{13cm}
\begin{tabular}{p{0.008\linewidth}p{0.008\linewidth}p{0.008\linewidth}p{0.4\linewidth}p{0.4\linewidth}}
%-- multirow solution does not work right... dont know why.
%& \multirow{3}{*}{\rotatebox[origin=c]{90}{Property Text 1 large}} & & %
%
%-- solution without multirow but now the table row hight grows with it's inner elements
& & &
Caption A:\newline Text Text Text Text Text Text Text Text Text Text Text Text Text Text & %
Caption B:\newline Text Text Text Text Text Text Text Text Text Text Text Text Text Text \\
%%
& \rotatebox[origin=c]{90}{Property Text 1 large} %
& \rotatebox[origin=c]{90}{Unit 1 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
%%
\rotatebox[origin=c]{90}{Property Text 2} & %
& \rotatebox[origin=c]{90}{Unit 2 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
%%
& \rotatebox[origin=c]{90}{Property Text 3} %
& \rotatebox[origin=c]{90}{Unit 3 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
%%
\rotatebox[origin=c]{90}{Property Text 4 large} & %
& \rotatebox[origin=c]{90}{Unit 4 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
& & & \vspace{1cm} & \vspace{1cm}
\end{tabular}
\end{minipage}
\end{document}
我认为我需要为“property-text-1-large”单元格添加类似 HTML-CSS 命令“position:absolute”的功能,以便外部表格元素不会随着内部内容大小而增大。我知道这不是一个好的解决方案,但我认为这是最简单的?
所以结果应该是这样的
非常感谢
答案1
如果你真的不关心输出是什么样子,你可以使用,它是和\clap
的变体\llap
\rlap
在这篇TUGboat文章成为:
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
把这个定义放在序言中(或者加载mathtools
包(也定义它)然后将任何要重叠的文本括起来,如下所示:
\clap{Property Text 1 large}
警告:这执行绝对没有检查以确保其他附近的文本不会被叠印。请小心使用!
\documentclass{standalone}
\usepackage[demo]{graphicx} % added demo because I don't have your images
\usepackage{adjustbox}
\usepackage{multirow}
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\begin{document}
%%- Cropped Image
\newcommand{\croppedimg}[1]%
{% v-- also added `height' option to force spacing gaps
\adjustbox{valign=c}{\includegraphics[width=1\linewidth,height=0.5\linewidth,clip=true,trim=90pt 60pt 50pt 140pt]{#1}}%
}%
\begin{minipage}[t]{13cm}
\begin{tabular}{p{0.008\linewidth}p{0.008\linewidth}p{0.008\linewidth}p{0.4\linewidth}p{0.4\linewidth}}
%-- multirow solution does not work right... dont know why.
%& \multirow{3}{*}{\rotatebox[origin=c]{90}{Property Text 1 large}} & & %
%
%-- solution without multirow but now the table row hight grows with it's inner elements
& & &
Caption A:\newline Text Text Text Text Text Text Text Text Text Text Text Text Text Text & %
Caption B:\newline Text Text Text Text Text Text Text Text Text Text Text Text Text Text \\
%%
& \rotatebox[origin=c]{90}{\clap{Property Text 1 large}} %
& \rotatebox[origin=c]{90}{Unit 1 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
%%
\rotatebox[origin=c]{90}{Property Text 2} & %
& \rotatebox[origin=c]{90}{Unit 2 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
& & & \vspace{1cm} & \vspace{1cm}
\end{tabular}
\end{minipage}
\end{document}
答案2
如果你不介意添加自动地(必要时)图像行之间有一些垂直空间,这里有一个使用更简单的代码(仅)的解决方案:我在一列内3 columns
定义一个\verticaltext
命令:right-aligned
\documentclass[draft]{article}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{adjustbox}
\newcommand\verticaltext[1]{ \rotatebox[origin=c]{90}{\begin{tabular}{c}#1 \end{tabular}}}
\begin{document}
%%- Cropped Image
\newcommand{\croppedimg}[1]%
{%
\adjustbox{valign=c}{\includegraphics[width=1\linewidth,clip=true,trim=90pt 60pt 50pt 140pt, height =2.5cm]{#1}}%
}%
\begin{minipage}[t]{13cm}
\begin{tabular}{rp{0.4\linewidth}p{0.4\linewidth}}
&
Caption A:\newline Text Text Text Text Text Text Text Text Text Text Text Text Text Text & %
Caption B:\newline Text Text Text Text Text Text Text Text Text Text Text Text Text Text \\[-3ex]
%%
\verticaltext{Property Text 1 large \\Unit 1 Text}& \croppedimg{black.png} & \croppedimg{black.png} \\
%%
\verticaltext{Property Text 2 \\Unit 2 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
%%
\verticaltext{Property Text 3\\ Unit 3 Text}& \croppedimg{black.png} & \croppedimg{black.png} \\
%%
\verticaltext{Property Text 4 large \\Unit 4 Text} & \croppedimg{black.png} & \croppedimg{black.png} \\
& \vspace{1cm} & \vspace{1cm}
\end{tabular}
\end{minipage}
\结束{文档}