Graphics, Figures & TablesTable placement in Beamer and pdf output

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
venik
Posts: 12
Joined: Thu Feb 01, 2007 2:11 am

Table placement in Beamer and pdf output

Post by venik »

Two questions:
1) I created a table in Beamer, but I cannot center it. It ignores \centering , \begin{center}..\end{center} and even hspace{-.2in} does not work. It seems that Beamer uses a rather coarse grid, since positioning the table horizontally using hspace does not work and then overshoots the mark, leaving part of the table invisible.

2) I did all this in Lyx (1.6.7, Linux 64 bit), but when I exported it to Latex and ran it again (to discover whether the problem is with Lyx or with Latex/Beamer), I found that figures that looked fine under Lyx were shifted vertically when I compiled the .tex file into pdf. Why is there a difference between what Lyx (which is only a GUI front to Latex) produces and what Latex outputs?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Table placement in Beamer and pdf output

Post by Stefan Kottwitz »

Hi venik,

perhaps post a minimal working example showing the problem. Your description does not tell which tabular environment do you use and if you use a (floating) table environment.

Stefan
LaTeX.org admin
venik
Posts: 12
Joined: Thu Feb 01, 2007 2:11 am

Table placement in Beamer and pdf output

Post by venik »

Since I am not sure how to post Latex files, I shall paste it here. As you can see, the Latex was exported from Lyx, and the table is not floating (no sense in floating graphics in a Beamer presentation).
Thanks for your help

Code: Select all

%% LyX 1.6.7 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{beamer}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{amsmath}
\usepackage{amssymb}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
\DeclareRobustCommand*{\lyxarrow}{%
\@ifstar
{\leavevmode\,$\triangleleft$\,\allowbreak}
{\leavevmode\,$\triangleright$\,\allowbreak}}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 % this default might be overridden by plain title style
 \newcommand\makebeamertitle{\frame{\maketitle}}%
 \AtBeginDocument{
   \let\origtableofcontents=\tableofcontents
   \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
   \def\gobbletableofcontents#1{\origtableofcontents}
 }
 \makeatletter
 \long\def\lyxframe#1{\@lyxframe#1\@lyxframestop}%
 \def\@lyxframe{\@ifnextchar<{\@@lyxframe}{\@@lyxframe<*>}}%
 \def\@@lyxframe<#1>{\@ifnextchar[{\@@@lyxframe<#1>}{\@@@lyxframe<#1>[]}}
 \def\@@@lyxframe<#1>[{\@ifnextchar<{\@@@@@lyxframe<#1>[}{\@@@@lyxframe<#1>[<*>][}}
 \def\@@@@@lyxframe<#1>[#2]{\@ifnextchar[{\@@@@lyxframe<#1>[#2]}{\@@@@lyxframe<#1>[#2][]}}
 \long\def\@@@@lyxframe<#1>[#2][#3]#4\@lyxframestop#5\lyxframeend{%
   \frame<#1>[#2][#3]{\frametitle{#4}#5}}
 \makeatother
 \def\lyxframeend{} % In case there is a superfluous frame end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usetheme{Madrid}
%\usecolortheme{crane}
% or ...
\setbeamertemplate{navigation symbols}{}

\setbeamercovered{transparent}

\makeatother
\usepackage{babel}
\begin{document}
\title[]{Introduction to Neuroimaging}
\subtitle{\emph{In vivo} methods}
\author[]{Ehud Kaplan, Ph.D.\inst{1} \and Cheuk Tang, Ph.D.\inst{2}}

\institute[E. Kaplan]{\inst{1}Neuroscience Department\\
MSSM\and \inst{2}Radiology Department\\
MSSM}

\date[Neuroimaging]{}
\makebeamertitle
\AtBeginSubsection[]{

  \frame<beamer>{
    \frametitle{Outline}
    \tableofcontents[currentsection,currentsubsection]
  }
}
\beamerdefaultoverlayspecification{<+->}
\lyxframeend{}

\lyxframe{Neuroimaging methods: \emph{Overview}}
\begin{center}\vspace{-.375in}\begin{tabular}{|>{\raggedright}p{2cm}||>{\centering}p{1.35cm}|>{\centering}p{1.6cm}|>{\centering}p{0.74in}|>{\centering}p{0.7in}|>{\centering}p{0.4in}|}
\hline
\noun{Method} & \textbf{\emph{\scriptsize Spatial resolution}} & \textbf{\emph{\scriptsize Temporal resolution}} & \textbf{\emph{\scriptsize Structural information}} & \textbf{\emph{\scriptsize Functional information?}} & \textbf{\emph{\scriptsize Invasive?}}\tabularnewline
\hline
\hline
\textbf{\emph{\scriptsize MRI}} & {\footnotesize good} & {\footnotesize none} & {\footnotesize yes} & {\footnotesize no} & {\footnotesize no}\tabularnewline
\hline
\textbf{\emph{\scriptsize fMRI}} & {\footnotesize \textasciitilde{}1 mm (3T)} & {\footnotesize \textasciitilde{}1 sec} & {\footnotesize no} & {\footnotesize yes} & {\footnotesize no}\tabularnewline
\hline
\textbf{\emph{\scriptsize PET}} & {\footnotesize \textasciitilde{}2-5 mm} & {\footnotesize poor} & {\footnotesize yes} & {\footnotesize yes} & {\footnotesize yes}\tabularnewline
\hline
\textbf{\emph{\scriptsize Optical Imaging (dyes)}} & {\footnotesize excellent} & {\footnotesize excellent (picosec)} & {\footnotesize yes} & {\footnotesize yes} & {\footnotesize yes}\tabularnewline
\hline
\textbf{\emph{\scriptsize optical imag. (intrinsic)}} & {\footnotesize \textasciitilde{}50$\mu$} & {\footnotesize \textasciitilde{}1 sec} & {\footnotesize yes} & {\footnotesize yes} & {\footnotesize yes}\tabularnewline
\hline
\textbf{\emph{\scriptsize Optical imaging (2 h$\nu$)}} & {\footnotesize superb (<1 $\mu$)} & {\footnotesize dye dependent} & {\footnotesize yes} & {\footnotesize yes (with calcium dyes)} & {\footnotesize yes}\tabularnewline
\hline
\textbf{\emph{\scriptsize MEG}} & {\footnotesize poor} & {\footnotesize <1 msec} & {\footnotesize no} & {\footnotesize yes} & {\footnotesize no}\tabularnewline
\hline
\textbf{\emph{\scriptsize EROS}} & {\footnotesize poor} & {\footnotesize good} & {\footnotesize none} & {\footnotesize yes} & {\footnotesize no}\tabularnewline
\hline
\end{tabular}\end{center}

\lyxframeend{}
\end{document}
Post Reply