我有一个tikz 网格使用 Beamer 中的文本。但是,它不知何故移到了左侧。我该如何更改它,以便它显示在幻灯片的中心?
以下是网格的代码:
\begin{tikzcd}
& {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & \Huge i \in I & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & {} & & {} & & {} & {} & {} \\
\Huge x_1 & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
\Huge x_2 & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
\Huge \ldots & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
\Huge x_n & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
& {} & & {} & & {} & & {} & & {} & & {} & & &
\end{tikzcd}
以下是完整来源:
\documentclass{beamer}
\usepackage[english]{babel}
% Scale tikzcd
\usepackage{adjustbox}
% For geometric interpretation
\usepackage{tikz} %
\usetikzlibrary{chains,shapes,arrows,%
trees,matrix,positioning,decorations}
\def\smalldot#1{\draw[fill=black] (#1) %
node [inner sep=1.3pt,shape=circle,fill=black] {}}
% For graphs
\usepackage{tikz-cd}
\begin{document}
\begin{frame}[fragile]
\adjustbox{scale=.75,center}{
% https://tikzcd.yichuanshen.de/#N4Igdg9gJgpgziAXAbVABwnAlgFyxMJZARgBoAGAXVJADcBDAGwFcYkQQBfU9TXfQigDMFanSat2XHiAzY8BIgFZRNBizaIO3XvIFEAbKvEb2AHTMAJZgHMYAAiz2LWMPYCS03f0UoA7MbqklpesnwKgsgAnIESmtoycj6RxGRUanFSOmF6vsjkpMRiQfGhSRFEAByFxZkh2eX6KMQFRRmm9YnhTSQATDXtwQneFc0ibSZDZd15xAAsA5OlDTORBb21HSAW1nb2AB4A+sTTuZFGG4PxO7YOFoxQEDgIK2dEBUKbU6-JRC2knyuWS6b2a-UBS2BIx6xBEEJKUJyv2aC3hdWGSNG+VIcy+1ystwOh16p2RyCMuKBWhue3uj2epKxBSUeMRjVmzNZnWhs36LKpGPZKRE-Mh3MxMIWooR4qF71IBi52wJtLMDyeLxBZKMioFNLuavpmp5a1IfiVjJhBXNAstvLNFp+WNhDttTslrrFgtW8sqSv1RMI7ryRj9epVBvVDODpqijq1zoKcbdCZh-WTXrtwtIGZl3tBJAWufRWb+hXSmZjRHGFbzpZQKha8ZNRACTZTLZQMXbldTszIPbrnDEMCgdgQKFAADMAE4QAC2SAKIBwECQczIYrAzEYjBojHoACMYIwAAo+rSMGBTnAgGgACxg9Cg7EgYDY2VnC6Qm9X6-6W47nuIAHseZ4XiB163g+T4vlob4fjIX6LogAF-ogcwiIBu77keJ7nqCkE3neICPs+r4EIh05zihCwrmuGF0TK244SBeHgYRV7ETB5HwZRoTIUgKj0euwnMUBuFgQRyJEdBpGwRR74CTRSBGCJGFqeJrGgfhEFcXJZFweA-GfipiABOp-zYcBOkcTJ+kkYZilUSAgmIMQwnocQFlaTZ7HSaMsmOQpfFKaZ36oWhDG9ExdQsX5Ul6VBwW8cZYVIWZvQxOpQibr5km6ZxyU8UZCHKRFQhqehQjVNZBV2YFDklc5XCUJwQA
\begin{tikzcd}
& {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & \Huge i \in I & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & {} & & {} & & {} & {} & {} \\
\Huge x_1 & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
\Huge x_2 & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
\Huge \ldots & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
\Huge x_n & & & & & & \Huge \ldots & & & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {} & {} & {} \\
& {} & & {} & & {} & & {} & & {} & & {} & & &
\end{tikzcd}
}
\end{frame}
\end{document}
答案1
整个图表 ( tikzpicture
) 实际上并没有向左移动,而是完全居中。如果你这样做,你就会发现
\begin{tikzcd}[execute at end picture={
\draw [ultra thick, blue] (current bounding box.south east) rectangle (current bounding box.north west);
}
]
并将比例因子设置为\adjustbox
较低的数字:
这也会向您显示问题,即图表右侧有大量空白。这是由末尾的两个空列引起的。删除这些空列,您将得到
注意不要删除第 13 列(倒数第三列)以及{}
那里的发现。这些是用作水平线的端点。
\documentclass{beamer}
\usepackage[english]{babel}
% Scale tikzcd
\usepackage{adjustbox}
% For geometric interpretation
\usepackage{tikz} %
\usetikzlibrary{chains,shapes,arrows,%
trees,matrix,positioning,decorations}
\def\smalldot#1{\draw[fill=black] (#1) %
node [inner sep=1.3pt,shape=circle,fill=black] {}}
% For graphs
\usepackage{tikz-cd}
\begin{document}
\begin{frame}[fragile]
\adjustbox{scale=.75,center}{
% https://tikzcd.yichuanshen.de/#N4Igdg9gJgpgziAXAbVABwnAlgFyxMJZARgBoAGAXVJADcBDAGwFcYkQQBfU9TXfQigDMFanSat2XHiAzY8BIgFZRNBizaIO3XvIFEAbKvEb2AHTMAJZgHMYAAiz2LWMPYCS03f0UoA7MbqklpesnwKgsgAnIESmtoycj6RxGRUanFSOmF6vsjkpMRiQfGhSRFEAByFxZkh2eX6KMQFRRmm9YnhTSQATDXtwQneFc0ibSZDZd15xAAsA5OlDTORBb21HSAW1nb2AB4A+sTTuZFGG4PxO7YOFoxQEDgIK2dEBUKbU6-JRC2knyuWS6b2a-UBS2BIx6xBEEJKUJyv2aC3hdWGSNG+VIcy+1ystwOh16p2RyCMuKBWhue3uj2epKxBSUeMRjVmzNZnWhs36LKpGPZKRE-Mh3MxMIWooR4qF71IBi52wJtLMDyeLxBZKMioFNLuavpmp5a1IfiVjJhBXNAstvLNFp+WNhDttTslrrFgtW8sqSv1RMI7ryRj9epVBvVDODpqijq1zoKcbdCZh-WTXrtwtIGZl3tBJAWufRWb+hXSmZjRHGFbzpZQKha8ZNRACTZTLZQMXbldTszIPbrnDEMCgdgQKFAADMAE4QAC2SAKIBwECQczIYrAzEYjBojHoACMYIwAAo+rSMGBTnAgGgACxg9Cg7EgYDY2VnC6Qm9X6-6W47nuIAHseZ4XiB163g+T4vlob4fjIX6LogAF-ogcwiIBu77keJ7nqCkE3neICPs+r4EIh05zihCwrmuGF0TK244SBeHgYRV7ETB5HwZRoTIUgKj0euwnMUBuFgQRyJEdBpGwRR74CTRSBGCJGFqeJrGgfhEFcXJZFweA-GfipiABOp-zYcBOkcTJ+kkYZilUSAgmIMQwnocQFlaTZ7HSaMsmOQpfFKaZ36oWhDG9ExdQsX5Ul6VBwW8cZYVIWZvQxOpQibr5km6ZxyU8UZCHKRFQhqehQjVNZBV2YFDklc5XCUJwQA
\begin{tikzcd}[execute at end picture={\draw [ultra thick, blue] (current bounding box.south east) rectangle (current bounding box.north west);}]
& {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & \Huge i \in I & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & & {} \arrow[dddddddddd, no head] & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & {} & & {} & &{}\\
\Huge x_1 & & & & & & \Huge \ldots & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {}\\
\Huge x_2 & & & & & & \Huge \ldots & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {}\\
\Huge \ldots & & & & & & \Huge \ldots & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {}\\
\Huge x_n & & & & & & \Huge \ldots & & & & & & \\
{} \arrow[rrrrrrrrrrrr, no head] & & & & & & & & & & {} & & {}\\
& {} & & {} & & {} & & {} & & {} & & {}
\end{tikzcd}
}
\end{frame}
\end{document}