4

I'm looking for a way to inset an entire paragraph and add a vertical line to the left of it with some vertical text in the middle (text need not be a variable, there's only going to be 3 or 4 different words in total):

enter image description here

I have no idea where to start looking. Should I use a table and a Tikz image in the first column? Some sort of mini-page? Is there a package that already does this? I'm using the framed package with the leftbar environment at the moment, but it doesn't allow me to insert some text into the middle of the bar.

The paragraphs will differ in height, but they'll never span multiple pages so 'in the middle' is a pretty easily defined property.

ps. This is pretty close, but not quite.

  • 1
    Please always provide a minimal working example i.e. a complete, minimal document which sets the problem up and gives people something to work from. You can use the packages lipsum, kantlipsum or blindtext for 'dummy' text. – cfr Feb 21 '16 at 3:02
5

With help of TikZ:

enter image description here

Code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}

\newcommand\verpar[2]{
    \par\vskip1ex
\noindent\begin{tikzpicture}[
paragraph/.style = {inner sep=0pt,
                    text width=\textwidth-\baselineskip}
                            ]
\node (p1) [paragraph] {#2};
\path ([xshift=-0.75\baselineskip] p1.south west) coordinate (p2)
            -- node (p3) [sloped,font=\sffamily] {#1} (p2 |- p1.north);
\draw[very thick] (p2) -- (p3.west) (p3.east) -- (p2 |- p1.north);
\end{tikzpicture}}

\begin{document}
\lipsum[1]

\verpar{Text}{\lipsum[2]}

\lipsum[3]
\end{document}
3

Without the help of TikZ:

enter image description here

\documentclass[a4paper]{article}
\usepackage{lipsum}
\usepackage{libertine}
\parindent0pt\parskip.5em
\usepackage{graphicx,xcolor}

\def\labelpar#1#2{\vspace{.25\baselineskip}%
\noindent\hfill{\color{gray!50}\vrule width 2pt}\hspace{-2ex}%
\fboxrule2pt\fboxsep.6ex\fcolorbox{white}{white}{%
\rotatebox[origin=c]{90}{\color{cyan}\sffamily\bfseries #1}}\hfill%
\begin{minipage}[c]{\dimexpr\linewidth-4ex}\color{red!40!black}
\parfillskip=0pt\sffamily#2\end{minipage}\vspace{.25\baselineskip}\par}

\begin{document}
\lipsum[1]
\labelpar{Some text}{\lipsum[2]}
\lipsum[3]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.