TikZ-cd的设置问题

2020-04-09 17:40发布

```tex \documentclass[a4paper,UTF8,twoside]{article} \usepackage{amsmath} \usepackage{amssymb} \usep...

```tex \documentclass[a4paper,UTF8,twoside]{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{tikz-cd} \usepackage[heading=true]{ctex} \usepackage[margin=20mm]{geometry} \begin{document} \section{} \begin{tikzcd} A\arrow[r,"\phi"] \arrow[rd] &B\\ &C \end{tikzcd} \begin{tikzcd} A\arrow[r,"\phi"]\arrow[d,red] &B\arrow[d,"\psi" red]\\ C\arrow[r,"\eta" blue] &D \end{tikzcd} \begin{tikzcd} A\arrow[r,"\phi"]\arrow[d,red,"x","y"'] &B\arrow[d,"\psi" red]\\ C\arrow[r,"\eta" blue] &D \end{tikzcd} \begin{tikzcd} A\arrow[r, "\phi" near start, "\psi"', "\eta" near end] &B \end{tikzcd} \begin{tikzcd} A\arrow[r, "\phi" very near start, "\psi"', "\eta" very near end] &B \end{tikzcd} \begin{center} \begin{tikzcd} A\arrow[r, "\phi" very near start, "\psi"', "\eta" very near end] &B \end{tikzcd} \end{center} \section{} \begin{tikzcd} T\arrow[rrd, bend left, "x"] \arrow[rd, dotted, "{(x,y)}"] \arrow[rdd, bend right, "y"] & &\\ &X\times_Z Y\arrow[r,"p"] \arrow[d,"q"] &X\arrow[d,"f"]\\ &Y\arrow[r,"g"] &Z \end{tikzcd} \begin{tikzcd} T\arrow[rrd, bend left, "x"] \arrow[rd, dotted, "{(x,y)}" description] \arrow[rdd, bend right, "y"] & &\\ &X\times_Z Y\arrow[r,"p"] \arrow[d,"q"] &X\arrow[d,"f"]\\ &Y\arrow[r,"g"] &Z \end{tikzcd} \begin{tikzcd} T\arrow[rrd] \arrow[rrd, bend left, "x"] \arrow[rd, dotted, "{(x,y)}" description] \arrow[rdd] \arrow[rdd, bend right, "y"] & &\\ &X\times_Z Y\arrow[r,"p"] \arrow[d,"q"] &X\arrow[d,"f"]\\ &Y\arrow[r,"g"] &Z \end{tikzcd} \begin{displaymath} qqq \end{displaymath} ``` 有以下三个问题: 1.居中显示采用center环境,是最佳方案吗? 2.如何让section2的三个交换图横向并排? 3.如何实现左侧是交换图,右侧是其他的内容?比如,最下面的displaymath环境直接在图表的下方,请问如何让其在图表的右侧? 谢谢!
1条回答
你这个文档是 `tikz-cd`的练习习作,不是排版的作品,因此: 1. 很难说 `center` 是不是最佳方案,你需要知道的是 `center` 环境本质上是一个 `list`,因此它和上下文之间都有额外的间距。在你实际需要完成的作品中是不是需要这个间距,得你自己来判断。 2. section 2 的三个交换图之间不留空行分段就都在一个段落里,一行正好能放得下。当然你可以把它们各自放到 `minipage` 里,用并排排列 `minipage` 的方法实现并排、对齐等等。 3. 用两个并排的 `minipage` 就可以了。用你的一个图做个MWE ```tex \documentclass{article} \usepackage{amsmath,amssymb} \usepackage{tikz-cd} \begin{document} \begin{minipage}{0.45\linewidth} \centering \begin{tikzcd} T\arrow[rrd, bend left, "x"] \arrow[rd, dotted, "{(x,y)}"] \arrow[rdd, bend right, "y"] & &\\ &X\times_Z Y\arrow[r,"p"] \arrow[d,"q"] &X\arrow[d,"f"]\\ &Y\arrow[r,"g"] &Z \end{tikzcd} \end{minipage}\hfill \begin{minipage}{0.45\linewidth} \begin{displaymath} x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \end{displaymath} \end{minipage} \end{document} ``` btw: 代码贴的时候要贴全,为啥少了 `\end{document}` 呢?

一周热门 更多>