Cómo dibujar una línea vertical con exactamente la altura de un parbox al lado
Estoy tratando de crear pequeñas secciones para un CV donde el nombre de la sección y una línea vertical deben estar al lado del contenido. El nombre de la sección debe estar centrado y la línea vertical debe ser exactamente la altura del contenido. Esta es la salida deseada:

Ahora, con mi código, no sé cómo establecer la altura de la línea vertical para obtener exactamente la altura del \parbox
. Por eso, para la demostración, lo he configurado en 1 cm. ¿Alguien sabe cómo obtener el resultado deseado con pequeñas modificaciones en mi código o una forma aún mejor de lograrlo?
\documentclass[12pt]{standalone}
\usepackage{tikz}
\newcommand{\lorem}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.}
\newcommand{\customsection}[2]{
\begin{minipage}{0.05\textwidth}
\rotatebox[origin=c]{90}{#1}
\hspace{0.01cm}
\begin{tikzpicture}
\fill [bottom color=red, top color=blue] (0cm, 0cm) rectangle (-0.05cm, 1cm);
\end{tikzpicture}
\end{minipage}
\parbox[c]{0.85\textwidth}{
#2
}
}
\begin{document}
\customsection{TEST}{\lorem \\ \lorem \\ \lorem}
\end{document}
También intenté acceder a la altura de parbox, que no me funcionó: altura de acceso de un \ parbox
Gracias por adelantado.
Mi salida:

Respuestas
¿Qué tal el siguiente código? La documentación se proporciona en el código como comentarios.
\documentclass[12pt]{standalone}
\usepackage{tikz}
\newcommand{\lorem}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.}
% Define owmal's box to store the \parbox
\newsavebox\owmalsbox
% Notice where `%' are added to suppress end-of-line spaces!
\newcommand{\customsection}[2]{%
% First we save \parbox into \owmalsbox.
% We also use \strut both at the beginning and at the end,
% and this will ensure that the first line and the last line
% have the same height (in most cases).
\sbox\owmalsbox{%
\parbox[c]{0.85\textwidth}{%
\strut#2\strut
}%
}%
% The total height of the \parbox is now available as
% \the\ht\owmalsbox+\the\dp\owmalsbox, so we can put our
% side-way text at (\the\ht\owmalsbox+\the\dp\owmalsbox)/2,
% and draw our rectangle accordingly. The minipage has the
% optional argument `c' to go with `\parbox[c]...' above.
% Notice again the use of \strut in the side-way text.
\begin{minipage}[c]{0.05\textwidth}
\begin{tikzpicture}
\node [rotate=90, above] at
(-0.05cm, {(\the\ht\owmalsbox+\the\dp\owmalsbox)/2})
{\strut#1};
\fill [bottom color=red, top color=blue]
(0cm, 0cm)
rectangle
(-0.05cm, \the\ht\owmalsbox+\the\dp\owmalsbox);
\end{tikzpicture}%
\end{minipage}%
% The following additional space depends on how you setup
% the minipage (it is 0.05\textwidth wide for now).
% Adjust these if necessary.
\hspace{0.5cm}%
% Finally we typeset \owmalsbox by releasing its content
% (and also destroy its content).
\unhbox\owmalsbox
}
\begin{document}
\customsection{TEST}{\lorem \\ \lorem \\ \lorem}
\end{document}
