如何对齐图表中列的括号

如何对齐图表中列的括号
\begin{tikzcd}[%
    ]
\Bigg\{ \text{Lorem Ipsum} \Bigg\} \arrow[rr, "\text{dolor sit amet...}"'] \arrow[dd, "\text{sed ligula porttitor...}"']                                        &  & \Bigg\{ \text{Consectetur adipiscing elit} \Bigg\} \arrow[dd, "\text{eros eu dictum...}"]        \\
                                                                                                                                                                   &  &                                                                                                 \\
\Bigg\{ \text{Praesent pretium purus} \Bigg\} \arrow[rr, "\text{velit in porttitor...}", dashed]                                                       &  & \Bigg\{ \text{Class aptent taciti} \Bigg\}                                        \\
                                                                                                                                                                   &  &                                                                                                 \\
\Bigg\{ \text{Nam facilisis} \Bigg\} \arrow[uu, "\text{accumsan porttitor...}"] \arrow[rr, "\text{fringilla mi sed...}", dashed] &  & \Bigg\{ \text{Mauris ligula} \Bigg\} \arrow[uu, "\text{nec velit massa...}"', dashed]
\end{tikzcd}

在此处输入图片描述

我希望图表上每个节点的括号对齐(以便水平箭头对齐),并且如果可能的话,允许括号内(居中对齐)多行文本。我该怎么做?

答案1

像这样吗?(请注意,花括号内的“框”中启用了自动换行。)

在此处输入图片描述

\documentclass{article} % or some other suitable document class

\usepackage[margin=1in]{geometry}  % set page parameters as needed
\usepackage{amsmath} % for \text macro
\usepackage{tikz-cd}

\newlength\mylen
\settowidth\mylen{Consectetur adipiscing} % desired width of 'box'
\newcommand\mybox[1]{\parbox{\mylen}{\centering #1}}

\begin{document}

\begin{tikzcd} %[]
\Biggl\{ \mybox{Lorem Ipsum} \Biggr\} 
\arrow[rr, "\text{dolor sit amet...}"'] 
\arrow[dd, "\text{sed ligula porttitor...}"']
&  & 
\Biggl\{ \mybox{Consectetur adipiscing elit} \Biggr\} 
\arrow[dd, "\text{eros eu dictum...}"] 
\\
&  &  \\
\Biggl\{ \mybox{Praesent pretium purus} \Biggr\} 
\arrow[rr, "\text{velit in portti...}", dashed]  
&  & 
\Biggl\{ \mybox{Class aptent taciti} \Biggr\}  \\
&  &   \\
\Biggl\{ \mybox{Nam facilisis} \Biggr\} 
\arrow[uu, "\text{accumsan porttitor...}"] 
\arrow[rr, "\text{fringilla mi sed...}", dashed]
&  & 
\Biggl\{ \mybox{Mauris ligula} \Biggr\} 
\arrow[uu, "\text{nec velit massa...}"', dashed]
\end{tikzcd}

\end{document}

相关内容