Graphics, Figures & TablesCentering a columns in a table about \pm

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

Centering a columns in a table about \pm

Post by angleg »

Hello,

I have generated a table of about 8 columns that have middle centering each and in 4 of the columns I would like to have the column of data to be centered about the plus and minus sign. My thoughts were to create a save box that was centered about the \pm and insert this inside the table. Unfortunately, the original tables centering is overriding my desire to change this based on what I place in the column. Below is an example of the first two rows of a 26 row table.

the savebox will go into the last 4 columns which I want to be centered about the \pm


newsavebox\myboxa
\savebox\myboxa{%
$\begin{array}{rcl}
0.3& \pm &.02
\end{array}$}
\newsavebox\myboxaa
\savebox\myboxaa{%
$\begin{array}{rcl}
3824.2 &\pm &772.6
\end{array}$}
\newsavebox\myboxaaa
\savebox\myboxaaa{%
$\begin{array}{rcl}
88.5& \pm &2.4
\end{array}$}
\newsavebox\myboxaaaa
\savebox\myboxaaaa{%
$\begin{array}{rcl}
79.6& \pm &2.9
\end{array}$}

\newsavebox\myboxb
\savebox\myboxb{%
$\begin{array}{rcl}
0.25&\pm&.02
\end{array}$}
\newsavebox\myboxbb
\savebox\myboxbb{%
$\begin{array}{rcl}
4375.5&\pm&89
\end{array}$}
\newsavebox\myboxbbb
\savebox\myboxbbb{%
$\begin{array}{rcl}
76.7&\pm&2.2
\end{array}$}
\newsavebox\myboxbbbb
\savebox\myboxbbbb{%
$\begin{array}{rcl}
67.9&\pm&2.8
\end{array}$}

\begin{table*}[!h]
\caption{\label{tab:table4}A Summary of detailed syllable analysis}
\begin{ruledtabular}
\begin{tabular}{lllccccc}
$Syllable$ &$Frequency Sweep$ &$Repeated$ &$Duration$ &$Spacing$ &$Dominent Frequency/PF$ &$Peak Power$ &$Energy$\\

\hline
A& Linear & Single & \usebox\myboxa& $ - $ & \usebox\myboxaa & \usebox\myboxaaa &\usebox\myboxaaaa \\
B& Linear & Single & \usebox\myboxb& $ - $ & \usebox\myboxbb & \usebox\myboxbbb & \usebox\myboxbbbb\\
\end{tabular}
\end{ruledtabular}
\end{table*}

Thanks for any help.
angleg

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Centering a columns in a table about \pm

Post by localghost »

At first, please
  • Always provide a small, complete and compilable, shortly said a minimal working example (MWE).
  • Use the code environment for tagging longer pieces of code to keep this code and the post clear.
Alignment in this way can be done either with dcolumn or siunitx.


Best regards
Thorsten
Post Reply