答案1
是的,可以做到。只要付出足够的努力,几乎任何输出都可以在 LaTeX 中创建。我不是tabular
专家,但我在下面提供了一个尝试作为示例。如前所述,这是一个广泛的问题,MWE 将非常有助于准确展示您希望实现的目标以及在什么规范下实现的目标。
\documentclass{article}
\usepackage[margin=2cm]{geometry} % prevent overfull hbox from wide table
\usepackage{graphicx} % for \rotatebox
\usepackage{colortbl} % for \cellcolor
\begin{document}
\begin{tabular}{|p{3cm}p{3cm}p{1cm}p{2cm}p{1cm}p{0.3cm}p{0.3cm}p{0.3cm}p{0.3cm}|}
\hline\multicolumn{9}{|l|}{}\\
\multicolumn{2}{|l}{\LARGE Longer longer heading line 1} & & \cellcolor[gray]{0.8}{} & & \multicolumn{4}{r|}{123-456-7}\\
\multicolumn{2}{|l}{\LARGE Longer longer heading line 2} & & \multicolumn{1}{c}{\cellcolor[gray]{0.8}{QR}} & & & & &\\[0.5cm]
28.2.2024 & Some venue & & & & & & &\\
20:00 & 100 USD & & & & & & &\\[1cm]
\multicolumn{5}{|l}{Basic ticket} & & & &\\[0.5cm]
\multicolumn{5}{|l}{Seat 24} & & & &\\
\multicolumn{5}{|l}{\tiny very tiny longer sentence. very tiny longer sentence.} & \rotatebox{90}{28.2.2024} & \rotatebox{90}{20:00} & \rotatebox{90}{Basic ticket} & \rotatebox{90}{Seat 24}\\[0.5cm]
\hline
\end{tabular}
\end{document}
答案2
我会申请tikz
这个。可以只使用minipage
s 或\parbox
es 来完成它,但tikz
对定位和对齐的控制会稍微多一点。
如果要调整文本行间距,请使用setspace
。然后,添加以下可选设置之一:[doublespacing]
、[onehaldspacing]
、插入开关宏、 sa\onehalfspacing
或\doublespacing
。如果需要微调,请使用\setstretch{<factor>}
和1.0
作为标准间距。或者简单地附加\vspace{}
一次性额外的垂直间距。
我不知道那张票是否有任何尺寸。因此,下面的示例使用了一些任意值的宽度和高度
\documentclass[margin=1cm]{standalone}
\usepackage[doublespacing]{setspace}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newlength\ticketheight
\setlength\ticketheight{6cm}
\begin{document}
\begin{tikzpicture}[
node distance = 1cm,
every node/.style = {
inner sep=0pt,
outer sep=0pt,
},
]
\node (A) {%
\parbox[t][\ticketheight][s]{7cm}{
{\LARGE\setstretch{1}%
Longer longer heading line 1
Longer longer heading line 2
\par}
\vspace{\fill}%
\begin{tabular}{@{}p{4cm} l@{}}
28.2.2024 & Some venue \\
20:00 & 100 USD
\end{tabular}
\vspace{\fill}%
Basic ticket
Seat 24
\vspace{\fill}%
{\tiny\setstretch{1}%
Much much longer sentence. Much much longer sentence.
Description at the bottom.
\par}}
};
\node [right=of A] (B) {
\parbox[t][\ticketheight]{3cm}{%
\includegraphics[width=\linewidth]{example-image}}
};
\node [right=of B] (C) {
\parbox[t][\ticketheight][s]{2cm}{
{\centering
123-456-7
\par}
\vspace{\fill}%
\raggedleft\onehalfspacing\small
\rotatebox{90}{%
\begin{tabular}[b]{@{}l@{}}
28.2.2024 \\
20:00 \\
Basic ticket \\
Seat 24
\end{tabular}}}
};
\end{tikzpicture}
\end{document}