![如何对齐图表中列的括号](https://linux22.com/image/457134/%E5%A6%82%E4%BD%95%E5%AF%B9%E9%BD%90%E5%9B%BE%E8%A1%A8%E4%B8%AD%E5%88%97%E7%9A%84%E6%8B%AC%E5%8F%B7.png)
\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}