Generalhelp understanding formatting in cells

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
noematic.logos
Posts: 19
Joined: Thu May 15, 2008 8:31 pm

help understanding formatting in cells

Post by noematic.logos »

Hi everyone,

I have a situation where I have data in a table and in some of the cells I place a footnote symbol to indicate it is statistically significant. However, because my table declaration sets the column to center in those cells with the footnote symbol the numbers don't align with the rest of the column, which makes sense. However, visually, I want the numbers to align not the entire cell contents. So i'm wondering what is the best approach to ensuring the numbers align. I'm not married to center align, but in the case where the contents are not center aligned, I still want the headers center aligned and I haven't figured out how to align cells separately...

I am using the ctable package for this, but I don't think that matters for this particular question.

Here is the table:

Code: Select all

\ctable[
	caption=Table of correlations, some are significant!,
	label=tbl:corr
	]{@{}ccccccc@{}}{
	\tnote[]{\hspace*{-.8em}\textit{Note.} This footnote is important.}
	\tnote[*]{\textit{p} $<$ 0.05}
}
{\FL
Component & 2 & 3 & 4 & 5 & 6 & 7 \ML
1. component 1 & 0.80\tmark[*] (.64) & 0.80 (.64)\tmark[*] &  0.75\tmark[*] (.60)\tmark[*]  &  0.70 (.49) & 0.65 (.38) & 0.50 (.25) \NN
2. component 2 & & 0.80 (.64) & 0.75 (.60)  & 0.70 (.49) & 0.65 (.38) & 0.50 (.25) \NN
3. component 3 &  &  &  0.75 (.60) & 0.70 (.49) & 0.65 (.38) &  0.50 (.25) \NN
4. component 4 &  &   &   &  0.70 (.49) & 0.65 (.38) & 0.50 (.25) \NN
5. component 5 &   &   &   &   &  0.65 (.38) & 0.50 (.25) \LL 
}
Thanks for any suggestions!

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

help understanding formatting in cells

Post by Stefan Kottwitz »

Hi noematic.logos,

if the footnote symbols by \tmark destroy the alignment, try it using \rlap:

Code: Select all

\renewcommand*\tmark[1][a]{%
   \rlap{\textsuperscript{\normalfont\textit{#1\xspace}}}}
Stefan
LaTeX.org admin
noematic.logos
Posts: 19
Joined: Thu May 15, 2008 8:31 pm

Re: help understanding formatting in cells

Post by noematic.logos »

Hi

Thanks for the code Stefan_K
noematic.logos
Posts: 19
Joined: Thu May 15, 2008 8:31 pm

help understanding formatting in cells

Post by noematic.logos »

I forgot to ask, if I insert the code above one ctable definition (I'm assuming it just goes above), will the code apply to all following \tmark or just the immediate one? How do i make the renew apply to just the local \tmark versus all following \tmark? I tried putting the renew command inside the ctable definition and it got mad at me...

secondly, can you briefly explain how the syntax?

Code: Select all

\renewcommand*\tmark[1][a]{% 
\rlap{\textsuperscript{\normalfont\textit{#1\xspace}}}}
specifically

Code: Select all

 *\tmark[1][a] 
thanks!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

help understanding formatting in cells

Post by Stefan Kottwitz »

Then create a new macro instead of redefining \tmark:

Code: Select all

\newcommand*\vmark[1][a]{%
   \rlap{\textsuperscript{\normalfont\textit{#1\xspace}}}}
Use \tmark normally and \vmark just when you need it.

Concerning the syntax: \vmark is the macro name, often enclosed in braces for definition (common but not necessary), the star marks a "short command". That means the parameter cannot span over more than one paragraph, it cannot contain \par. This makes it easier to find possible errors, that's why I prefer the starred form when I know the parameter cannot contain paragraph breaks. [1] marks the number of parameters and [a] is its default value if no parameter was given.

Stefan
LaTeX.org admin
noematic.logos
Posts: 19
Joined: Thu May 15, 2008 8:31 pm

Re: help understanding formatting in cells

Post by noematic.logos »

wow, so cool!!!

Thanks so much!! I ran into a prof and told him I was using latex instead of word, he's like, oh brother, why bother, just type it in word save time...but when I see the kind of control I have in making tables now, like aligning to a decimal point...word simply can't compete...of course that b/c I'm writing a thesis and not a company memo... :)
Post Reply