在投影机中安装桌子的问题

在投影机中安装桌子的问题

我尝试使用\resizebox幻灯片来适应表格,但遇到了一些错误。请帮我解决这个问题。

\documentclass{beamer}
\usepackage{graphicx}
\usepackage[labelsep=quad,indention=10pt]{subfig}
\usepackage{tikz}
\usetikzlibrary{matrix,chains,positioning,decorations.pathreplacing,arrows,calc,}
\usetikzlibrary{decorations.markings}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{array}% http://ctan.org/pkg/array
\usepackage{amsmath,amsthm,relsize}
\usepackage{adjustbox}
\def \symstalinear{ 
$f(x) = 
\begin{cases}
    -1,                 & \quad \hfill x<-1.\\
    \phantom{-}x,       & \quad \hfill -1 \leq x \leq1\\
    \phantom{-}1,       & \quad \hfill x>1
\end{cases}$
}
\def \hardlimit{
$f(x) = \begin{cases}
  0 &\quad \hfill x<0\\
  1 &\quad \hfill x \geq 0\\
\end{cases}
$
}
\begin{document}
\frame{
 \resizebox{width=\textwidth}{height=\textheight}{
\begin{table}[h!]
    \begin{center}
        \begin{tabular}{ l >{$}c<{$} >{$}c<{$}}
        \toprule
        \textbf{Function} & \multicolumn{1}{c}{\textbf{Definition}}  & \multicolumn{1}{c}{\textbf{Range}} \\
        \midrule
        Linear & f(x)=x & (-\infty,\infty) \\[2ex]
        Log-sigmoid & \dfrac{1}{1+e^{-x}}&(0,1)\\[3ex]
        Hyperbolic Tangent Sigmoid & \dfrac{e^x-e^{-x}}{e^x+e^{-x}}&(-1,1)\\[3ex]
        Symmetric Saturating Linear & $\symstalinear$ & [-1,1] \\[3ex]
        Hard limit & $\hardlimit$ &[0,1]\\
        \bottomrule
        \end{tabular}

    \end{center}
\caption{Definitons of activation function}
\label{tbl:def of act func}
\end{table}%
}
}
\end{document}

答案1

该命令对于您的 \resizebox 来说是错误的。应该是

\resizebox{xxcm}{!} {  % ! keep the aspectratio with xx width, no need to use width=xx. 
  \begin{tabular}...
  \end{tabular}
}

\scaleboxgraphicx 也同样有效。

\scalebox{0.7}{
  \begin{tabular}...
  \end{tabular}
}

在此处输入图片描述

代码

\documentclass{beamer}
\usepackage{graphicx}
\usepackage[labelsep=quad,indention=10pt]{subfig}
%\usepackage{tikz}
%\usetikzlibrary{matrix,chains,positioning,decorations.pathreplacing,arrows,calc,}
%\usetikzlibrary{decorations.markings}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{array}% http://ctan.org/pkg/array
\usepackage{amsmath,amsthm,relsize}
%\usepackage{adjustbox} % This seems to cause a problem too.
\def\symstalinear{% 
$f(x) = 
\begin{cases}
    -1,                 & \quad \hfill x<-1.\\
    \phantom{-}x,       & \quad \hfill -1 \leq x \leq1\\
    \phantom{-}1,       & \quad \hfill x>1
\end{cases}$
}
\def\hardlimit{%
$f(x) = \begin{cases}
  0 &\quad \hfill x<0\\
  1 &\quad \hfill x \geq 0
\end{cases}
$
}
\begin{document}
\frame{
\begin{table}[h!]
    \begin{center}
\resizebox{\textwidth}{!}{
        \begin{tabular}{ l >{$}c<{$} >{$}c<{$}}
        \toprule
        \textbf{Function} & \multicolumn{1}{c}{\textbf{Definition}}  & \multicolumn{1}{c}{\textbf{Range}} \\
        \midrule
        Linear & f(x)=x & (-\infty,\infty) \\[2ex]
        Log-sigmoid & \dfrac{1}{1+e^{-x}}&(0,1)\\[3ex]
        Hyperbolic Tangent Sigmoid & \dfrac{e^x-e^{-x}}{e^x+e^{-x}}&(-1,1)\\[3ex]
        Symmetric Saturating Linear & $\symstalinear$ & [-1,1] \\[3ex]
        Hard limit & $\hardlimit$ &[0,1]\\
        \bottomrule
        \end{tabular}
}
    \end{center}
\caption{Definitons of activation function}
\label{tbl:def of act func}
\end{table}%
}
\end{document}

相关内容