不使用 \tabular,这样在换页时文本会逐行中断。
我对表格的尝试是这样的(后来我意识到这是不可破坏的):
\definecolor{darkred}{RGB}{128,0,0}
\newcommand{\expEntry}[4]{%
\begin{table}[H]
\raggedright
\begin{tabular*}{\textwidth}{L{0.6cm}| @{\extracolsep{\hspace{0.35cm}}} l @{\extracolsep{\fill}} r}
& \textbf{#2} & \footnotesize\addfontfeature{Color=lightgray} #3 \\
\rotatebox[origin=c]{90}{ \addfontfeature{Color=darkred} #1} &
\multicolumn{2}{l}{
\begin{minipage}[t]{0.94\linewidth}
#4
\end{minipage}
} \\
\end{tabular*}
\end{table}
}
\expEntry
{June 2018 until May 2019}
{Roses are red}
{Violets are blue}
{
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nunc non blandit massa enim nec dui nunc.
\begin{itemize}
\item At risus viverra adipiscing at in tellus integer feugiat. Tempus imperdiet nulla malesuada pellentesque elit eget.
\item Proin sed libero enim sed faucibus turpis. Viverra aliquet eget sit amet tellus.
\item Felis bibendum ut tristique et egestas quis. Venenatis lectus magna fringilla urna porttitor rhoncus.
\item Turpis massa sed elementum tempus egestas. Arcu cursus euismod quis viverra nibh cras.
\item Neque convallis a cras semper auctor. Purus semper eget duis at tellus at urna condimentum mattis.
\item At risus viverra adipiscing at in tellus integer feugiat. Tempus imperdiet nulla malesuada pellentesque elit eget.
\item Proin sed libero enim sed faucibus turpis. Viverra aliquet eget sit amet tellus.
\end{itemize}
}
不用担心图片的左边距,这是因为它嵌入在图片右侧对齐的小页面中。我希望它的宽度为 \textwidth。
编辑(回复@NBur):在文本中间的分页符后,是否可以不重复标题和日期?此外,似乎有一个“故障”(下图左侧的蓝色圆圈),根据缩放,面向标题的垂直线部分会消失。似乎是因为这部分线不太粗,我想知道为什么?也许是软件包错误?
答案1
这是使用 mdframed 的解决方案。
\documentclass[a4paper, 12pt]{article}
\usepackage{tikzpagenodes}
\usepackage[tikz]{mdframed}
\tikzset{
warningsymbol/.style={
rectangle,draw=red,
fill=white,scale=1,
overlay}}
\makeatletter
\def\mdf@@date{}%new mdframed key:
\define@key{mdf}{date}{%
\def\mdf@@date{#1}
}
\def\mdf@@subtitle{}%new mdframed key:
\define@key{mdf}{subtitle}{%
\def\mdf@@subtitle{#1}
}
\mdfdefinestyle{Yannick}{%
hidealllines=true,leftline=true,
rightmargin=\ifdefempty{\mdf@@date}{0pt}{1.7em},%
leftmargin=\ifdefempty{\mdf@@date}{1.5em}{0pt},%
linecolor=gray,%
extra={\ifdefempty{\mdf@@date}{}{\node[rotate=90, anchor=south east, red] at (O|-P) {\mdf@@date};}%
\ifdefempty{\mdf@@subtitle}{}{\node[gray,anchor=north east] at (P) {\small\mdf@@subtitle};}
},%
}
\begin{document}
\tikz[remember picture, overlay] \draw [green] (current page text area.south west) rectangle (current page text area.north east);
\begin{mdframed}[date={June 2018 until May 2019}, frametitle={Roses are red}, subtitle={Violets are blue}, style=Yannick]
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nunc non blandit massa enim nec dui nunc.
\begin{itemize}
\item At risus viverra adipiscing at in tellus integer feugiat. Tempus imperdiet nulla malesuada pellentesque elit eget.
\item Proin sed libero enim sed faucibus turpis. Viverra aliquet eget sit amet tellus.
\item Felis bibendum ut tristique et egestas quis. Venenatis lectus magna fringilla urna porttitor rhoncus.
\item Turpis massa sed elementum tempus egestas. Arcu cursus euismod quis viverra nibh cras.
\item Neque convallis a cras semper auctor. Purus semper eget duis at tellus at urna condimentum mattis.
\item At risus viverra adipiscing at in tellus integer feugiat. Tempus imperdiet nulla malesuada pellentesque elit eget.
\item Proin sed libero enim sed faucibus turpis. Viverra aliquet eget sit amet tellus.
\end{itemize}
\end{mdframed}
Title, subtitle and date can be omitted
\begin{mdframed}[style=Yannick]
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nunc non blandit massa enim nec dui nunc.
\begin{itemize}
\item At risus viverra adipiscing at in tellus integer feugiat. Tempus imperdiet nulla malesuada pellentesque elit eget.
\item Proin sed libero enim sed faucibus turpis. Viverra aliquet eget sit amet tellus.
\item Felis bibendum ut tristique et egestas quis. Venenatis lectus magna fringilla urna porttitor rhoncus.
\item Turpis massa sed elementum tempus egestas. Arcu cursus euismod quis viverra nibh cras.
\item Neque convallis a cras semper auctor. Purus semper eget duis at tellus at urna condimentum mattis.
\item At risus viverra adipiscing at in tellus integer feugiat. Tempus imperdiet nulla malesuada pellentesque elit eget.
\item Proin sed libero enim sed faucibus turpis. Viverra aliquet eget sit amet tellus.
\end{itemize}
\end{mdframed}
\tikz[remember picture, overlay] \draw [green] (current page text area.south west) rectangle (current page text area.north east);
\end{document}
(绿色框显示文本区域。)
编辑
为了考虑到备注,您可以重新定义 mdfstyle,如下所示:
\mdfdefinestyle{Yannick}{%
hidealllines=true,leftline=true,
rightmargin=\ifdefempty{\mdf@@date}{0pt}{3.3ex},%
leftmargin=\ifdefempty{\mdf@@date}{3.3ex}{0pt},%
linecolor=gray,%
singleextra={\ifdefempty{\mdf@@date}{}{\node[rotate=90, anchor=south east, red, text height=1.5ex, text depth=.25ex] at (O|-P) {\mdf@@date};}%
\ifdefempty{\mdf@@subtitle}{}{\node[gray,anchor=north east] at (P) {\small\mdf@@subtitle};}%
},%
firstextra={\ifdefempty{\mdf@@date}{}{\node[rotate=90, anchor=south east, red, text height=1.5ex, text depth=.25ex] at (O|-P) {\mdf@@date};}%
\ifdefempty{\mdf@@subtitle}{}{\node[gray,anchor=north east] at (P) {\small\mdf@@subtitle};}%
},%
middleextra={\node[rotate=90, anchor=south east, red, text height=1.5ex, text depth=.25ex] at (O|-P) {};},%
secondextra={\node[rotate=90, anchor=south east, red, text height=1.5ex, text depth=.25ex] at (O|-P) {};},%
}
因此,您可以根据是否只有一帧或者是否被分割来定义行为。
对于规则的开始,我猜测这只是由于 pdf 查看器。