在多列环境中添加水平标记的水平箭头

在多列环境中添加水平标记的水平箭头

我附上了一张我试图创建的图片。问题是,当我尝试在 Latex 中执行此操作时,我弄乱了间距。

我想在顶部两个表格之间添加一个粗体黑色箭头,在底部两个表格之间添加另一个粗体黑色箭头。我还想用特定文本标记这些箭头。

有没有办法在不破坏间距的情况下导入图形,或者有没有办法在 Latex 内部用文本创建这些箭头?

谢谢。

在此处输入图片描述

\documentclass[xcolor=pdftex,dvipsnames,table]{beamer}
\usepackage{array,tabularx,hhline}
\usepackage{amsthm,amsmath,amssymb}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{url}
% Set theme to UNA2
\usetheme{UNA2}

\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand{\mc}[1]{\multicolumn{1}{c}{\small #1}}
\newcommand{\divides}{\bigm|}
\newcommand{\ndivides}{%
\mathrel{\mkern.5mu % small adjustment
% superimpose \nmid to \big|
\ooalign{\hidewidth$\big|$\hidewidth\cr$\nmid$\cr}%
}%
}

\begin{document}

\begin{frame}[fragile]{Quasigroups and the Sudoku Property}

\begin{tabularx}{\textwidth}{CC}
\begin{tabular}{|c|c||c|c|}
\mc{\phantom{1}} \\% Empty line
\hline
1 & 3 & 2 & 4 \\
\hline
2 & 4 & 3 & 1 \\
\hhline{|=|=#=|=|}
3 & 1 & 4 & 2 \\
\hline
4 & 2 & 1 & 3 \\
\hline
\end{tabular} &
\begin{tabular}{c|c|c||c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 3 & 2 & 4 \\
\cline{2-5}
\small 2 & 2 & 4 & 3 & 1 \\
\hhline{~|=|=#=|=|}
\small 3 & 3 & 1 & 4 & 2 \\
\cline{2-5}
\small 4 & 4 & 2 & 1 & 3 \\
\cline{2-5}
\end{tabular} \\
\begin{tabular}{c} A $4\times4$ table with \\ $2\times2$ Sudoku blocks \end{tabular} &
\begin{tabular}{c} A labeled $4\times4$ table \\ with $2\times2$ Sudoku blocks
\end{tabular} \\[2\normalbaselineskip]%
\begin{tabular}{c|c|c|c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 2 & 3 & 4 \\
\cline{2-5}
\small 2 & 2 & 3 & 4 & 1 \\
\cline{2-5}
\small 3 & 3 & 4 & 1 & 2 \\
\cline{2-5}
\small 4 & 4 & 1 & 2 & 3 \\
\cline{2-5}
\end{tabular} &
\begin{tabular}{c|c|c||c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 2 & 3 & 4 \\
\cline{2-5}
\small 2 & 3 & 4 & 1 & 2 \\
\hhline{~|=|=#=|=|}
\small 3 & 2 & 4 & 1 & 3 \\
\cline{2-5}
\small 4 & 4 & 2 & 3 & 1 \\
\cline{2-5}
\end{tabular} \\
\begin{tabular}{c} A Cayley Table representing \\ a Quasigroup \end{tabular} &
\begin{tabular}{c} The same Quasigroup with \\ the Sudoku property \end{tabular}
\end{tabularx}

\end{frame}

\end{document}

答案1

一种可能性是使用tikzmark图书馆:

在此处输入图片描述

代码:

\documentclass[xcolor=pdftex,dvipsnames,table]{beamer}
\usepackage{array,tabularx,hhline}
\usepackage{amsthm,amsmath,amssymb}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{url}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

% Set theme to UNA2
%\usetheme{UNA2}

\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand{\mc}[1]{\multicolumn{1}{c}{\small #1}}
\newcommand{\divides}{\bigm|}
\newcommand{\ndivides}{%
\mathrel{\mkern.5mu % small adjustment
% superimpose \nmid to \big|
\ooalign{\hidewidth$\big|$\hidewidth\cr$\nmid$\cr}%
}%
}

\begin{document}

\begin{frame}[fragile]{Quasigroups and the Sudoku Property}

\begin{tabularx}{\textwidth}{CC}
\begin{tabular}{|c|c||c|c|}
\mc{\phantom{1}} \\% Empty line
\hline
1 & 3 & 2 & 4 \\
\hline
2 & 4 & 3 & 1 \tikzmark{starta}\\
\hhline{|=|=#=|=|}
3 & 1 & 4 & 2 \\
\hline
4 & 2 & 1 & 3 \\
\hline
\end{tabular} &
\begin{tabular}{c|c|c||c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 3 & 2 & 4 \\
\cline{2-5}
\small \tikzmark{enda}2 & 2 & 4 & 3 & 1 \\
\hhline{~|=|=#=|=|}
\small 3 & 3 & 1 & 4 & 2 \\
\cline{2-5}
\small 4 & 4 & 2 & 1 & 3 \\
\cline{2-5}
\end{tabular} \\
\begin{tabular}{c} A $4\times4$ table with \\ $2\times2$ Sudoku blocks \end{tabular} &
\begin{tabular}{c} A labeled $4\times4$ table \\ with $2\times2$ Sudoku blocks
\end{tabular} \\[2\normalbaselineskip]%
\begin{tabular}{c|c|c|c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 2 & 3 & 4 \\
\cline{2-5}
\small 2 & 2 & 3 & 4 & 1 \tikzmark{startb} \\
\cline{2-5}
\small 3 & 3 & 4 & 1 & 2 \\
\cline{2-5}
\small 4 & 4 & 1 & 2 & 3 \\
\cline{2-5}
\end{tabular} &
\begin{tabular}{c|c|c||c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 2 & 3 & 4 \\
\cline{2-5}
\small \tikzmark{endb}2 & 3 & 4 & 1 & 2 \\
\hhline{~|=|=#=|=|}
\small 3 & 2 & 4 & 1 & 3 \\
\cline{2-5}
\small 4 & 4 & 2 & 3 & 1 \\
\cline{2-5}
\end{tabular} \\
\begin{tabular}{c} A Cayley Table representing \\ a Quasigroup \end{tabular} &
\begin{tabular}{c} The same Quasigroup with \\ the Sudoku property \end{tabular}
\end{tabularx}

\begin{tikzpicture}[remember picture,overlay,>=latex]
\draw[->,line width=2pt]
  ([xshift=15pt,yshift=-0.4\baselineskip]pic cs:starta) -- node[above,align=center] {\strut Viewing as \\ Algebra\strut}
  ([xshift=-5pt,yshift=-0.4\baselineskip]{{pic cs:enda}|-{pic cs:starta}});
\draw[->,line width=2pt]
  ([xshift=15pt,yshift=-0.35\baselineskip]pic cs:startb) -- node[above,align=center] {\strut Applying \\ Sudoku\strut}
  ([xshift=-5pt,yshift=-0.35\baselineskip]{{pic cs:endb}|-{pic cs:startb}});
\end{tikzpicture}
\end{frame}

\end{document}

该代码需要运行两到三次才能稳定下来。

答案2

在此处输入图片描述

\documentclass[xcolor=pdftex,dvipsnames,table]{beamer}
\usepackage{array,tabularx,hhline}
\usepackage{amsthm,amsmath,amssymb}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{url}
% Set theme to UNA2
\usetheme{UNA2}

\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand{\mc}[1]{\multicolumn{1}{c}{\small #1}}
\newcommand{\divides}{\bigm|}
\newcommand{\ndivides}{%
\mathrel{\mkern.5mu % small adjustment
% superimpose \nmid to \big|
\ooalign{\hidewidth$\big|$\hidewidth\cr$\nmid$\cr}%
}%
}

\begin{document}

\begin{frame}[fragile]{Quasigroups and the Sudoku Property}

\begin{tabularx}{\textwidth}{CcC}
\begin{tabular}{|c|c||c|c|}
\mc{\phantom{1}} \\% Empty line
\hline
1 & 3 & 2 & 4 \\
\hline
2 & 4 & 3 & 1 \\
\hhline{|=|=#=|=|}
3 & 1 & 4 & 2 \\
\hline
4 & 2 & 1 & 3 \\
\hline
\end{tabular} &
\begin{tabular}{@{}c@{}}
Viewing as\\
Algebra\\[2ex]
\resizebox{1cm}{.6cm}{$\rightarrow$}
\end{tabular}
&
\begin{tabular}{c|c|c||c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 3 & 2 & 4 \\
\cline{2-5}
\small 2 & 2 & 4 & 3 & 1 \\
\hhline{~|=|=#=|=|}
\small 3 & 3 & 1 & 4 & 2 \\
\cline{2-5}
\small 4 & 4 & 2 & 1 & 3 \\
\cline{2-5}
\end{tabular} \\
\begin{tabular}{c} A $4\times4$ table with \\ $2\times2$ Sudoku blocks \end{tabular} &
&
\begin{tabular}{c} A labeled $4\times4$ table \\ with $2\times2$ Sudoku blocks
\end{tabular} \\[2\normalbaselineskip]%
\begin{tabular}{c|c|c|c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 2 & 3 & 4 \\
\cline{2-5}
\small 2 & 2 & 3 & 4 & 1 \\
\cline{2-5}
\small 3 & 3 & 4 & 1 & 2 \\
\cline{2-5}
\small 4 & 4 & 1 & 2 & 3 \\
\cline{2-5}
\end{tabular} &
\begin{tabular}{@{}c@{}}
Applying\\
Sudoko\\[2ex]
\resizebox{1cm}{.6cm}{$\rightarrow$}
\end{tabular}
&
\begin{tabular}{c|c|c||c|c|}
\mc{} & \mc{1} & \mc{2} & \mc{3} & \mc{4} \\
\cline{2-5}
\small 1 & 1 & 2 & 3 & 4 \\
\cline{2-5}
\small 2 & 3 & 4 & 1 & 2 \\
\hhline{~|=|=#=|=|}
\small 3 & 2 & 4 & 1 & 3 \\
\cline{2-5}
\small 4 & 4 & 2 & 3 & 1 \\
\cline{2-5}
\end{tabular} \\
\begin{tabular}{c} A Cayley Table representing \\ a Quasigroup \end{tabular} &&
\begin{tabular}{c} The same Quasigroup with \\ the Sudoku property \end{tabular}
\end{tabularx}

\end{frame}

\end{document}

相关内容