1

How can I do this : enter image description here

Without using \tabular so that the text can be broken line-by-line when changing page.

My attempt with tabular was this (I realized later this isn't breakable) :

\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}
    }

Nevermind the left margin on the picture, it's because it's embedded in a minipage justified at the right on the picture. I want it to be \textwidth wide.

EDIT (in response to @NBur): Is it possible to not repeat the title nor the date after a page break in the middle of the text? Besides, it seems there's a "glitch" (blue circle at the left of the picture below) where depending on the zoom, the part of the vertical line facing the title disappears. It seems because this part of the line is less thick, I wonder why? A package bug perhaps?

enter image description here

2
  • Did you look at tcolorbox or mdframed?
    – NBur
    Feb 8, 2021 at 17:11
  • Honestly I had not, but encasing the table inside \begin{tcolorbox} \end{tcolorbox} doesn't seem to help much. The margins are still violated and it doesn't seem to split anything correctly. Same for mdframed afaik (unless I'm missing something). I was hoping perhaps there's a way to achieve it without tables somewhat :(
    – Yannick
    Feb 8, 2021 at 18:44

1 Answer 1

1

Here is a solution with 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}

(The green frames show the text area.)

enter image description here

Edit

To take into account remarks, you can redefine the mdfstyle as follow:

\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) {};},%
}

Thus you define the behaviour depending if you have only one frame or if it is splitted.

For the beginning of the rule, I guess it's only due to the pdf viewer.

2
  • Thank you very much for the neat answer. I edited my question to point to some flaws. I wondered if you could help with those last bits? I will definitely have to study a bit more your solution as there's quite a bit of syntax alien to me. Nevertheless thanks a lot!
    – Yannick
    Feb 9, 2021 at 14:43
  • Concerning the "rule beginning", there really seems to be two lines superposed when varying the zoom at this area, one stops before the other (tad more large). I see that using frametitle={}, replacing with "title \hfill subtitle" solves this, but less elegantly. My (last!) question would be, with the tikz trick you used for the subtitle, is it possible to render the title this way as well so that frametitle is always unused? It would also have the added benefit to make the title optional as well. I will definitely read on tikz soon to understand the \node and (O|-P) syntax.
    – Yannick
    Feb 9, 2021 at 20:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .