我需要你的帮助。
我想要的是将两个公式/方程式并排放置。它们应该用中间的垂直线清楚地分开。
代码如下:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tabstackengine,amssymb}
\usepackage{tikz}
\stackMath
\newcommand\udash[2][\hrulefill]{\stackunder{#2}{\makebox[0.7em]{#1}}}
\newcommand\mygap{\udash[]{}}
\newcommand{\myq}{\,\,\,}
\begin{document}
\begin{center}
\[
\langle\tabbedShortunderstack{
\udash{x}&\mygap&\udash{}\\ i&&}\rangle_k
\langle\udash{}\mygap x \mapsto i\mygap\udash{}\rangle_{\mathrm{state}}
\]
\[
\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}
\]
\end{center}
\begin{flalign*} %diese sollen in der Mitte von einem vertikalen Strich getrennt werden
\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}
&\myq\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}
\end{flalign*}
\begin{tikzpicture}[overlay]
\draw[red] (0.5\textwidth,0.5) -- (0.5\textwidth,1.75);
\end{tikzpicture}
\end{document}
我将得到以下结果:
两个问题:第一,如何调整垂直线的长度?第二,如何调整公式和线之间的距离?应该清楚我的意思。
谢谢!
答案1
你可以使用tikzmark
它。这可以让你画出线确切地在中间,并calc
允许您固定长度。只需\qquad
在块之间添加即可控制距离。
\documentclass{article}
\usepackage{amsmath}
\usepackage{tabstackengine,amssymb}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\stackMath
\newcommand\udash[2][\hrulefill]{\stackunder{#2}{\makebox[0.7em]{#1}}}
\newcommand\mygap{\udash[]{}}
\newcommand{\myq}{\,\,\,}
\begin{document}
\begin{center}
\[
\langle\tabbedShortunderstack{
\udash{x}&\mygap&\udash{}\\ i&&}\rangle_k
\langle\udash{}\mygap x \mapsto i\mygap\udash{}\rangle_{\mathrm{state}}
\]
\[
\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}
\]
\end{center}
\begin{flalign*} %diese sollen in der Mitte von einem vertikalen Strich getrennt werden
\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}\tikzmarknode{l}{~}
\qquad\tikzmarknode{r}{~}\myq\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}
\end{flalign*}
\begin{tikzpicture}[overlay,remember picture]
\draw[red] ($(l.north)!0.5!(r.north)+(0,5mm)$) --
($(l.south)!0.5!(r.south)+(0,-3mm)$);
\end{tikzpicture}
\end{document}