Document Classesctable - formatting

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
noematic.logos
Posts: 19
Joined: Thu May 15, 2008 8:31 pm

ctable - formatting

Post by noematic.logos »

Hello,

Was wondering if someone could help me fix an error and format a table using the ctable package. The problem is that I have two levels of headers and i can't get all the padding and alignment equal.
1) if i define the multicolumn to be {c} the header isn't center aligned.
2) the following error comes up:
! Misplaced \omit.
\multispan ->\omit
\@multispan
l.395 }

3) how can i control the font size in the cells?

Code: Select all

\ctable[
caption=Title,
cap=list title,
label=tbl:1,
pos=t,
width=130mm,
left,
]{Xcccccc}
{
%\tnote[a]{A footnote is always good.}
}
{                                                                                                     \FL
&  & \multicolumn{3}{l}{Pre-test} \multicolumn{3}{c}{Post-test}    \NN
\cmidrule(r){2-4} \cmidrule(l){5-7}
Component & Mean & SD & Range & Mean & SD & Range              \ML
Component 1 & 25 & 3.4 & (13-32)  & 27 & 3.1 & (15-34)         \NN
Component 2 & 25 & 3.4 & (13-32)  & 27 & 3.1 & (15-34)         \NN
Component 3 & 25 & 3.4 & (13-32)  & 27 & 3.1 & (15-34)         \NN
Component 4 & 25 & 3.4 & (13-32)  & 27 & 3.1 & (15-34)         \NN
Component 5 & 25 & 3.4 & (13-32)  & 27 & 3.1 & (15-34)         \NN
Component 6 & 25 & 3.4 & (13-32)  & 27 & 3.1 & (15-34)         \NN
Component 7 & 25 & 3.4 & (13-32)  & 27 & 3.1 & (15-34)         \LL
}
Thanks for any advice!!

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

ctable - formatting

Post by Stefan Kottwitz »

Hi noematic.logos,

one column seperator symbol & seems to be not in the right place. Try:

Code: Select all

& \multicolumn{3}{c}{Pre-test} & \multicolumn{3}{c}{Post-test}    \NN
That may solve 1. and 2. Concerning 3. just use \small, \footnotesize, \tiny etc. inside the cells.

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

ctable - formatting

Post by noematic.logos »

Ran into another snag, hopefully it is as straightforward as the last one, thanks stefan! I would like to override the default serif font by using the \Times package. Everything works fine until I create a custom column type and use that column type in a table. If I use the custom column type, the fonts in the table go back to being the default. Why is this happening and what can I do to ensure the \Times fonts take hold everywhere? Thank you again.

Code: Select all

\documentclass{article}
\usepackage{ctable}
\usepackage{dcolumn}
\usepackage{caption}
\usepackage{xspace}
\usepackage[]{times}

%
\newcolumntype{.}{D{.}{.}{1.2}}

% a new footnote symbol tick called vmark
% has [1] parameter, whose default is [a]
\newcommand*\vmark[1][a]{%
	\rlap{\textsuperscript{\normalfont\textit{#1\xspace}}}}

\begin{document}

\captionsetup{labelsep=newline,singlelinecheck=false,textfont=it}
\ctable[
	caption={Table with Times font, no custom column},
	pos=h,
	width=110mm
	]{@{}Xcccccc@{}}{
	\tnote[]{\hspace*{-.8em}\textit{Note.} Post-test correlations are in parentheses.}
	\tnote[*]{\textit{p} $<$ 0.05}
}
{\FL
Component & 2 & 3 & 4 & 5 & 6 & 7 \ML
1. Component 1 &  &  &   & 0.70 (.49) & 0.65 (.38) & 0.50 (.25)        \NN
2. Component 2 &  &  &   & 0.70 (.49) & 0.65 (.38) & 0.50 (.25)         \NN
3. Component 3 &  &  &   & 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)        \NN
6. Component 6 &  &  &   &  & & 0.50 (.25)         \NN
7. Component 7 &   &  &   &  &  &          \LL 
}

\captionsetup{labelsep=newline,singlelinecheck=false,textfont=it}
\ctable[
	caption={Table with default times font, custom column},
	pos=h,
	width=110mm
	]{X....}{
	\tnote[]{\hspace*{-.6em}\textit{Note.} Funky cool footnote.}
	\tnote[*]{\textit{p} $<$ 0.05}
}
{\FL
& \multicolumn{2}{c}{Pre-test}& \multicolumn{2}{c}{Post-test} \NN
\cmidrule(r){2-3} \cmidrule(l){4-5}
\multicolumn{1}{l}{Component} & \multicolumn{1}{c}{CC} & \multicolumn{1}{c}{IC} & \multicolumn{1}{c}{CC} & \multicolumn{1}{c}{IC}  \ML
Component 1& 0.67 & 0.67\vmark[*] & 0.67 & 0.67          \NN
Component 2 & 0.67 &  0.67 &  0.67 &  0.67         \NN
Component 3 &  0.67 &  0.67 &  0.67 & 0.67         \NN
Component 4 &  0.67 &  0.67 &  0.67 &  0.67        \NN
Component 5 &  0.67\vmark[*] & 0.67  &  0.67 &  0.67        \NN
Component 6 &  0.67 &  0.67 &  0.67 &  0.67         \NN
Component 7 &  0.67 &  0.67 &  0.67\vmark[*] &  0.67        \NN[4pt]
Total score &  0.67 &  0.67  &  0.67 & 0.67\vmark[*]        \LL
}

\end{document}

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

ctable - formatting

Post by localghost »

The times package is obsolete. Replace it by mathptmx (in combination with helvet from the PSNFSS bundle and luximono) ...

Code: Select all

\usepackage{mathptmx}
\usepackage[scaled]{helvet}
\usepackage{luximono}
... or the txfonts.

Code: Select all

\usepackage{txfonts}
Perhaps this helps. The packages with their documentations and further information can be found on CTAN.


Best regards
Thorsten
noematic.logos
Posts: 19
Joined: Thu May 15, 2008 8:31 pm

ctable - formatting

Post by noematic.logos »

dear localghost,

thank you! I know this will sound stupid, but I'm looking at the txfonts directory on ctan and there are a bunch of directories (afm, doc, egtc)...where do i put the contents of these folders? The problem is that on a mac, I have no idea where latex is installed, i've looked and its just piles of directories everywhere. Its just super confusing...For example,

Code: Select all

texlive
   \2007
   \texmf-local

   2007\bin
            \texmf
            \texmf-config
            \texmf-dist\fonts\afm
                                         \enc
   
   texmf-local\bibtex
                      \dvips
                      \fonts\source
                                \tfm
                                \type1
                                \vf
noematic.logos
Posts: 19
Joined: Thu May 15, 2008 8:31 pm

ctable - formatting

Post by noematic.logos »

Here is an explanation for the latex directory structure! :)

http://theoval.sys.uea.ac.uk/~nlct/late ... llsty.html

With more here

Q4: Where do I put my personal additions to the texmf tree?
http://www.tug.org/mactex/faq/

And because I didn't know how, in order to use .ins and .dtx files, to generate the .sty files to put in the local directory, open the .ins file in texShop and LaTeX it! Learning, learning, learning!
Post Reply