带 4 个工作台的投影机框架

带 4 个工作台的投影机框架

我在用 beamer 框架排列 4 个表格时遇到了问题。每个表格包含 2 个我用 tikz 编写的图表,通过定义新的列类型,这些图表在水平和垂直方向上均居中。我尝试使用 minipages 排列这 4 个表格,但我不明白为什么表格不能保持大小。

在此处输入图片描述

我给你留下了一个可以编译的最小代码。

\documentclass[9pt, xcolor=dvipsnames]{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{enumerate}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{tabularx} 
\usepackage{booktabs,array} 
\newcolumntype{C}{>{\centering}m{0.3\linewidth}} 
\newcolumntype{D}{>{\centering}m{0.45\linewidth}} 
\usepackage{multirow}
\usepackage{longtable} 

\usepackage{pgfplots}
\pgfplotsset{/pgf/number format/use comma,compat=newest}
\usepgfplotslibrary{polar}
\usetikzlibrary{calc,angles, quotes}

\begin{document}
    \begin{frame}   
        \begin{minipage}[b]{0.50\linewidth}
            \centering  
            \begin{table}
                \centering
                \scalebox{0.5}{
                    \begin{tabular*}{\linewidth}{D!{\hfill}D!}
                        \toprule        
                        \large  \textsc{Real line}  &   \large \textsc{Complex plane} \tabularnewline
                        \midrule 
                        \vspace*{2.15cm}
                        \vspace*{1.4cm}
                        \begin{tikzpicture} [scale=0.8,>=latex]
                            \begin{axis} [xmin=-2,xmax=2,
                                ymin=-0.5,ymax=2,
                                axis equal image,
                                xtick={-2, -1, ..., 2},
                                axis x line=middle,
                                axis y line=none,
                                enlargelimits,
                                xlabel=$Re$,ylabel=$y$,
                                xlabel style={below, font=\normalsize },
                                ylabel style={ left, font=\Large },
                                ]
                                \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
                            \end{axis}
                        \end{tikzpicture}   
                        &  
                        \vspace*{1.8cm}
                        \begin{tikzpicture} [scale=.8,>=latex]
                            \begin{axis} [xmin=-2,xmax=2,
                                ymin=-0.5,ymax=2,
                                axis equal image,
                                axis lines=middle,
                                enlargelimits,
                                xtick={-2, -1, ..., 2},
                                ymajorticks=false,
                                xlabel=$Re$,
                                y axis line style={draw=none, insert path={ (axis cs:0,-0.5) edge[draw, dashed, -] (axis cs:0,2)}},             
                                xlabel style={below, font=\normalsize },
                                ]
                                \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
                                \draw [ ->, ultra thick,color=red] (0,0) -- (0,1);
                                \node[color=red, left] at (0,1) {\Large $i$};
                            \end{axis}
                        \end{tikzpicture}   
                        
                        \tabularnewline
                        \bottomrule
                    \end{tabular*}
                }
            \end{table} 
        \end{minipage}%%
        \begin{minipage}[b]{0.50\linewidth}
            \centering
            \begin{table}
                \centering
                \scalebox{0.5}{
                    \begin{tabular*}{\linewidth}{D!{\hfill}D!}
                        \toprule        
                        \large  \textsc{Real Line}  &   \large \textsc{Complex plane} \tabularnewline
                        \midrule 
                        \vspace*{2.15cm}
                        \vspace*{1.4cm}
                        \begin{tikzpicture} [scale=0.8,>=latex]
                            \begin{axis} [xmin=-2,xmax=2,
                                ymin=-0.5,ymax=2,
                                axis equal image,
                                xtick={-2, -1, ..., 2},
                                axis x line=middle,
                                axis y line=none,
                                enlargelimits,
                                xlabel=$Re$,ylabel=$y$,
                                xlabel style={below, font=\normalsize },
                                ylabel style={ left, font=\Large },
                                ]
                                \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
                            \end{axis}
                        \end{tikzpicture}   
                        &  
                        \vspace*{1.8cm}
                        \begin{tikzpicture} [scale=.8,>=latex]
                            \begin{axis} [xmin=-2,xmax=2,
                                ymin=-0.5,ymax=2,
                                axis equal image,
                                axis lines=middle,
                                enlargelimits,
                                xtick={-2, -1, ..., 2},
                                ymajorticks=false,
                                xlabel=$Re$,
                                y axis line style={draw=none, insert path={ (axis cs:0,-0.5) edge[draw, dashed, -] (axis cs:0,2)}},             
                                xlabel style={below, font=\normalsize },
                                ]
                                \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
                                \draw [ ->, ultra thick,color=red] (0,0) -- (0,1);
                                \node[color=red, left] at (0,1) {\Large $i$};
                            \end{axis}
                        \end{tikzpicture}   
                        
                        \tabularnewline
                        \bottomrule
                    \end{tabular*}
                }
            \end{table}
        \end{minipage}
    \end{frame}
\end{document}

目前我发现的唯一解决方案是截取各个表格的屏幕截图并按照列环境进行排列,但结果非常糟糕,因为质量很低,读起来很差:

在此处输入图片描述

你能帮助我吗?谢谢

答案1

您的 tikzpictures 比它们的单元格宽,然后您尝试缩小表格和 tikzpicture,因此它们仍然太大,因为 tikzpictures 和表格都同样缩小。


我建议:

  • 确保所有 tikz 图片都是相同的大小,例如通过向它们添加一条不可见的路径(确切的数字\path (0,0) rectangle (7,4);可能需要进行一些微调,这只是通过眼睛快速判断......)

  • 使用单个表使代码更简单

  • 调整 tikzpictures 的缩放比例,使它们排成一行。我使用了0.3以下缩放系数,可能还需要进行一些微调...

\documentclass[9pt, xcolor=dvipsnames]{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}

\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\usepackage{pgfplots}
\pgfplotsset{/pgf/number format/use comma,compat=newest}
\usepgfplotslibrary{polar}
\usetikzlibrary{calc,angles, quotes}

\begin{document}
    \begin{frame}
      \begin{tblr}{
        colspec=XXXX,
        cells={valign=m,halign=c},
        row{1}={font={\large}}
      }
      \cmidrule[r,0.8pt]{1-2}\cmidrule[l,0.8pt]{3-4}
      Real line  &   Complex plane & Real line  &   Complex plane\\
      \cmidrule[r]{1-2}\cmidrule[l]{3-4} 
      \begin{tikzpicture} [scale=0.3,>=latex]
          \path (0,0) rectangle (7,4);
          \begin{axis} [xmin=-2,xmax=2,
              ymin=-0.5,ymax=2,
              axis equal image,
              xtick={-2, -1, ..., 2},
              axis x line=middle,
              axis y line=none,
              enlargelimits,
              xlabel=$Re$,ylabel=$y$,
              xlabel style={below, font=\normalsize },
              ylabel style={ left, font=\Large },
              ]
              \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
          \end{axis}
      \end{tikzpicture}   
      &  
      \begin{tikzpicture} [scale=.3,>=latex]
          \path (0,0) rectangle (7,4);
          \begin{axis} [xmin=-2,xmax=2,
              ymin=-0.5,ymax=2,
              axis equal image,
              axis lines=middle,
              enlargelimits,
              xtick={-2, -1, ..., 2},
              ymajorticks=false,
              xlabel=$Re$,
              y axis line style={draw=none, insert path={ (axis cs:0,-0.5) edge[draw, dashed, -] (axis cs:0,2)}},             
              xlabel style={below, font=\normalsize },
              ]
              \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
              \draw [ ->, ultra thick,color=red] (0,0) -- (0,1);
              \node[color=red, left] at (0,1) {\Large $i$};
          \end{axis}
      \end{tikzpicture}
      &
      \begin{tikzpicture} [scale=0.3,>=latex]
          \path (0,0) rectangle (7,4);
          \begin{axis} [xmin=-2,xmax=2,
              ymin=-0.5,ymax=2,
              axis equal image,
              xtick={-2, -1, ..., 2},
              axis x line=middle,
              axis y line=none,
              enlargelimits,
              xlabel=$Re$,ylabel=$y$,
              xlabel style={below, font=\normalsize },
              ylabel style={ left, font=\Large },
              ]
              \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
          \end{axis}
      \end{tikzpicture}   
      &  
      \begin{tikzpicture} [scale=.3,>=latex]
          \path (0,0) rectangle (7,4);
          \begin{axis} [xmin=-2,xmax=2,
              ymin=-0.5,ymax=2,
              axis equal image,
              axis lines=middle,
              enlargelimits,
              xtick={-2, -1, ..., 2},
              ymajorticks=false,
              xlabel=$Re$,
              y axis line style={draw=none, insert path={ (axis cs:0,-0.5) edge[draw, dashed, -] (axis cs:0,2)}},             
              xlabel style={below, font=\normalsize },
              ]
              \draw [ ->, ultra thick,color=blue] (0,0) -- (1,0);
              \draw [ ->, ultra thick,color=red] (0,0) -- (0,1);
              \node[color=red, left] at (0,1) {\Large $i$};
          \end{axis}
      \end{tikzpicture}   \\
      \cmidrule[r,0.8pt]{1-2}\cmidrule[l,0.8pt]{3-4}
      \end{tblr}
    \end{frame}
\end{document}

在此处输入图片描述

相关内容