我正在编写一个 latex 文档,在使用 tikz 环境编写交换图时,编译后的图表的宽度超出了其余文本的宽度。以下是代码:
\documentclass[12pt,a4paper]{report}
\makeatletter
% these two slashes-commands for continuous chapter numbering in parts of the document
\makeatother
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\huge}{\thechapter.}{20pt}{\huge\bf} %for chapter headings
\RequirePackage{etoolbox}
\usepackage{tikz-cd} % and in the above line to use commutative diagrams
\usepackage{amsfonts}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
% below four lines to just one or two cyrillic letter
\DeclareFontFamily{U}{wncy}{}
\DeclareFontShape{U}{wncy}{m}{n}{<->wncyr10}{}
\DeclareSymbolFont{mcy}{U}{wncy}{m}{n}
\DeclareMathSymbol{\Sh}{\mathord}{mcy}{"58}
%Cyrillic letter command over
\usepackage{sagetex}
\usepackage[toc]{appendix} % to make appendi appear in the table of contents
\usepackage{amssymb} %to use direct sum symbol
\usepackage{graphicx} %toinsert images
\usepackage{amsmath} %to use matrices
\usepackage{hyperref}
\usepackage{bm} % to use bold font in math mode use \bm{ insert math mode text}
\usepackage{mathrsfs} %for scripted english characters
\usepackage{mathtools}
\usepackage{tikz-cd} % to draw commutative diagrams
\usepackage{enumitem}
All this can be combined in the following:
\[
\begin{tikzcd}
0 \arrow{r} &
\frac{E'(K)}{\phi(E(K))} \arrow{r}{\delta} \arrow{d} &
H^{1}(G_K, E[\phi]) \arrow{r} \arrow{d}{Res_v} &
WC(E/K)[\phi] \arrow{r} \arrow{d} & 0 \\
0 \arrow{r} &
\frac{E'(K_v)}{\phi(E(K_v))} \arrow{r}{\delta_{v}} \arrow{d} &
H^{1}(G_{v}, E[\phi]) \arrow{r} \arrow{d} &
WC(E/K_{v})[\phi] \arrow{r} \arrow{d} & 0 \\
0 \arrow{r} &
\prod\limits_{v \in M_K} \frac{E'(K_v)}{\phi(E(K_v))} \arrow{r}{\prod\limits_{v \in M_K}\delta_{v}} &
\prod\limits_{v \in M_K} H^{1}(G_{v}, E[\phi]) \arrow{r} &
\prod\limits_{v \in M_K} WC(E/K_{v})[\phi] \arrow{r} & 0
\tag{$**$}
\label{starstar}
\end{tikzcd}
\]
\end{document}
如果有人能帮助我,那就太好了。非常感谢。
答案1
为了使您的图表适合文本宽度,您应该采取两项措施:
- 减少节点之间的距离
- 使用较小的字体
- 使用包装
\mathclap
中的mathtools
说明来写出产品的限制:
\documentclass[12pt,a4paper]{report}
\usepackage{mathtools}
\usepackage{tikz-cd}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{equation}\label{starstar}
\begin{tikzcd}[sep=1.8em, font=\small]
0 \ar{r} & \frac{E'(K)}{\phi(E(K))} \ar{r}{\delta} \ar{d}
& H^{1}(G_K, E[\phi]) \ar{r} \ar{d}{Res_v} & WC(E/K)[\phi] \ar{r} \ar{d} & 0 \\
0 \ar{r} & \frac{E'(K_v)}{\phi(E(K_v))} \ar{r}{\delta_{v}} \ar{d}
& H^{1}(G_{v}, E[\phi]) \ar{r} \ar{d} & WC(E/K_{v})[\phi] \ar{r} \ar{d} & 0 \\
0 \ar{r} & \prod\limits_{\mathclap{v \in M_K}} \frac{E'(K_v)}{\phi(E(K_v))}
\ar{r}{\prod\limits_{\mathclap{v \in M_K}}\delta_{v}}
&
\prod\limits_{\mathclap{v \in M_K}} H^{1}(G_{v}, E[\phi]) \ar{r} &
\prod\limits_{\mathclap{v \in M_K}} WC(E/K_{v})[\phi] \ar{r} & 0
\end{tikzcd}
\tag{$**$}
\end{equation}
\end{document}