2

I know my headline sounds highly confusing so let me provide you my MWE

\documentclass{article}


\usepackage{tikz}

\usepackage[most]{tcolorbox}

\newtcolorbox{frameGray}{enhanced, colframe=black,colback=gray!3.5, boxrule=0.2pt,arc=0pt,outer arc=0pt,frame hidden, after skip = 12pt}

\newcommand{\boxGray}[1]{\tikz[baseline=(X.base)]\node [draw=gray!25,fill=gray!0,ultra thin,rectangle,inner sep=4pt,align=left] (X) {#1};}

\definecolor{bturq}{rgb}{0.0, 0.87, 0.87}

\newcommand{\raisedrule}[2][0em]{\leaders\hbox{\rule[#1]{1pt}{#2}}\hfill}

\newcommand{\hs}{\hspace{-6pt}}



\begin{document}

\pagenumbering{gobble}

\begin{frameGray}

\hs\boxGray{name, name:} \textcolor{bturq!60}{\raisedrule[3pt]{0.5pt}} \parbox{0.4\textwidth}{\boxGray{name, name}} 

\vspace{10pt}

\hs\boxGray{place:} \textcolor{bturq!60}{\raisedrule[3pt]{0.5pt}} \parbox{0.4\textwidth}{\boxGray{place \\  place}}

\end{frameGray}

\end{document}

This will create some text-boxes with a rule that is horizontally connected to other text-boxes.

What I want is the text-boxes on the left to be centered on top each other, but still with a rule coming out right where the text-boxes end (as is it is right now, just that the boxes are not centered but left aligned). Seems tricky.

Sketch:

I got:

name, name ------------------- name, name

                               place 
place ------------------------ 
                               place

I want:

name, name ------------------- name, name

                               place 
  place ---------------------- 
                               place

So that the text on the left is centered but the rules are still coming out from it.

2
  • 2
    hm, a sketch what you after will help us a lot to prepare an answer ...
    – Zarko
    Aug 16, 2023 at 19:20
  • I edited a sketch. Hope it helps.
    – Leon
    Aug 16, 2023 at 21:10

1 Answer 1

2

Thank you for editing of question!

enter image description here

Is this what you after?

Above solution use of the tikzmark library, packages tabularx and makecell:

\documentclass{article}
\usepackage[most]{tcolorbox}
\usetikzlibrary{tikzmark}
\usepackage{makecell, tabularx}

\newtcolorbox{frameGray}{
    enhanced, 
    frame hidden,
    colback=gray!3.5, 
    arc=0pt,   
    after skip = 12pt}


\begin{document}
\pagenumbering{gobble}

\begin{frameGray}
    \begin{tabularx}{\linewidth}{c X l}
\tikzmarknode{a}{name, name:}
    &   &   \tikzmarknode{b}{name, name}   \\[10pt] 
\tikzmarknode{c}{place:}
    &   &   \tikzmarknode{d}{\makecell[l]{place\\ place}} 
    \end{tabularx}
    \begin{tikzpicture}[overlay,remember picture,
                        arr/.style = {color=cyan, semithick, shorten <=4pt, shorten >=4pt}
                        ]
\draw[arr]   (a) -- (b);
\draw[arr]   (c) -- (d);
    \end{tikzpicture}
\end{frameGray}

\end{document}

For showed result you need to compile MWE three times.

1
  • Awesome, looks amazing!
    – Leon
    Aug 17, 2023 at 11:09

You must log in to answer this question.

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