Graphics, Figures & Tablesgraphic centered in table cell, horz and vert

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
angleg
Posts: 4
Joined: Thu Jul 23, 2009 8:08 pm

graphic centered in table cell, horz and vert

Post by angleg »

Hello,
I need assistance with two things please. I am generating a double column of tables within a table. First the graphics appear at the top of the cell which is off vertical center. I would like each cell to be vertically & horizontally centered whether it contains text, graphic, or array. How can I move it down within its cell?
The second problem is when I creat a framebox, my output has an "!" on the left exterior of the framed boxes.
thanks,
G

Code: Select all

\begin{table*}[htp]
\caption{\label{tab:table1b}  Each syllable is classified by an identification card consisting of the syllable, clipped spectrogram, and features.}
\begin{tabular}{>{\RaggedLeft}p{3.1in}>{\RaggedLeft}p{0.2in}
>{\RaggedLeft}p{3.1in}}\hline \\ 
\framebox[2\width, \totalheight][s]{
\begin{tabular}{ccc}
A &  \begin{center}
\includegraphics[width=4cm,height=2cm]{graphic.png} 
\end{center}
 & 
\begin{array}{l}
SC=822.95 \\SB=455.92\\ SRF=900\\SF=-876584\\SE=0.003188\\ZCR=1764\\FQ=1.29\%\\ \end{array}\\ 
\end{tabular}}
&

&
\framebox[2\width, \totalheight][s]{
\begin{tabular}{ccc}
B&
\includegraphics[width=4cm,height=2cm]{graphic.png} & 
\begin{array}{l}
SC=822.95 \\SB=455.92\\ SRF=900\\SF=-876584\\SE=0.003188\\ZCR=1764\\FQ=1.29\%\\ \end{array}\\ 
\end{tabular}}\\
\end{tabular}
\end{table*}

Recommended reading 2024:

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

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: graphic centered in table cell, horz and vert

Post by gmedina »

Hi,

please complete the code snippet that you posted, so as to make it compilable (please include the actual figures that you are using).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
angleg
Posts: 4
Joined: Thu Jul 23, 2009 8:08 pm

graphic centered in table cell, horz and vert

Post by angleg »

Sorry, I'm new to TeXnic; please understand. I'm going to assume this is what you need:

Code: Select all

\documentclass[nopreprint]{jasatex}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{dcolumn}
\usepackage{amsmath,amsfonts}
\usepackage{fancybox,calc}
\usepackage{bm}
\begin{document}
\begin{table*}[htp]
\caption{\label{tab:table1b}  Each syllable is classified by an identification card consisting of the syllable, clipped spectrogram, and features.}
\begin{tabular}{>{\RaggedLeft}p{3.1in}>{\RaggedLeft}p{0.2in}
>{\RaggedLeft}p{3.1in}}\hline \\ 
\framebox[3\width, \totalheight][s]{
\begin{tabular}{lcc}
A & 
\includegraphics[width=4cm,height=2cm]{SylA.png} & 
\scriptsize{\begin{array}{l}
SC=822.95 \\SB=455.92\\ SRF=900\\SF=-876584\\SE=0.003188\\ZCR=1764\\FQ=1.29\%\\ \end{array}}\\ 
\end{tabular}}
&

&
\framebox[3\width, \totalheight][s]{
\begin{tabular}{lcc}
B&
\includegraphics[width=4cm,height=2cm]{SylA.png} & 
\scriptsize{\begin{array}{l}
SC=822.95 \\SB=455.92\\ SRF=900\\SF=-876584\\SE=0.003188\\ZCR=1764\\FQ=1.29\%\\ \end{array}}\\ 
\end{tabular}}\\
\end{tabular}
\end{table*}
\end{document}
Attachments
graphic
graphic
SylA.png (15.43 KiB) Viewed 2942 times
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

graphic centered in table cell, horz and vert

Post by gmedina »

Hi,

is it something like the following what you are looking for?

Code: Select all

\documentclass[nopreprint]{jasatex}
\usepackage{amsmath}
\usepackage{tabularx}

\begin{document}

%create and fill a box to store the first data array to be used later
\newsavebox\myboxa
\savebox\myboxa{%
  $\begin{array}{l}
    SC=822.95 \\ SB=455.92\\
    SRF=900\\ SF=-876584\\
    SE=0.003188\\ ZCR=1764\\
    FQ=1.29\% 
  \end{array}$}

%create and fill a box to store the second data array to be used later
\newsavebox\myboxb
\savebox\myboxb{%
  $\begin{array}{l}
    SC=822.95 \\ SB=455.92\\
    SRF=900\\ SF=-876584\\
    SE=0.003188\\ ZCR=1764\\
    FQ=1.29\%
  \end{array}$}

%and now, the table:  
\begin{table*}
\caption{\label{tab:table1b} Each syllable is classified by an identification card consisting of the syllable, clipped spectrogram, and features.}
\begin{tabularx}{\textwidth}{XX}
  \framebox{%
    {\begin{tabular}{>{\centering}m{4.2cm}>{\centering}m{4cm}}
      \includegraphics[width=4cm,height=2cm]{SylA.png} & \usebox\myboxa
    \end{tabular}}} 
  &
  \framebox{%
    {\begin{tabular}{>{\centering}m{4.2cm}>{\centering}m{4cm}}
      \includegraphics[width=4cm,height=2cm]{SylA.png} & \usebox\myboxb
    \end{tabular}}} 
\end{tabularx}
\end{table*}

\end{document}
Remarks: 1) I deleted some packages that were not essential for my example code but you were including; please don't forget to load them again in your document.
2) Please refer to the documentations of the array and tabularx packages: array documentation, tabularx documentation.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
angleg
Posts: 4
Joined: Thu Jul 23, 2009 8:08 pm

Re: graphic centered in table cell, horz and vert

Post by angleg »

Hello,

Exactly what I was needing. I realized a few of my errors with brackets around the centering and "m" instead of "p" (point). I just made one small change; I needed to insert one more column to identify the syllable prior to the spectrogram. Your fantastic, now I can move on to the remaining challenges my thesis has in store for me.
Thanks again

G
Post Reply