Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I try to use \resizebox to fit table in slide, but I reach some error. Please help me fix this problem.

\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}
share|improve this question
    
don't resize the table environment, resize the `tabular within it. –  David Carlisle Dec 5 '13 at 1:44
    
It still the same error with only tabular. This error is: ! No room for a new \dimen . –  phuong Dec 5 '13 at 1:49

1 Answer 1

The command is error for your \resizebox. Should be

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

Also \scalebox from graphicx works too.

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

enter image description here

Code

\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.