Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Have two problems regarding ctable.

  • Have multiple ctables and would like the first column in the tables to have a fixed width (also the tables to have the same total width)?
  • When I add a \tnote[]{} to the ctable, the table is always placed to the center of the page. If i remove the \tnote, it is placed according to pos=.

EDIT: don't know if it is the \tnote which mess things up, but if i have these two tables:

\ctable[caption=Second OLS regression table, doinside=\small \renewcommand\arraystretch{1.2}, pos=ht]{lrrrr}{\tnote[]{OLS regression}}{
 \toprule
 \multicolumn{5}{c}{OLS Regression} \\
 & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\ 
  \midrule
(Intercept) & -0.13 & 0.07 & -1.76 & 0.08 \\ 
  reserves & -0.29 & 0.54 & -0.54 & 0.59 \\ 
  gsci & -0.52 & 0.32 & -1.62 & 0.11 \\ 
  L.logprem40 & 0.06 & 0.08 & 0.71 & 0.48 \\ 
  q1 & -0.18 & 0.10 & -1.83 & 0.07 \\ 
  q2 & -0.18 & 0.11 & -1.75 & 0.08 \\ 
  q3 & -0.20 & 0.13 & -1.51 & 0.13 \\ 
\bottomrule
}


\ctable[caption=Second quantile regression table I, doinside=\small \renewcommand\arraystretch{1.2},pos=ht]{lrrrrrrr}{\tnote[]{Resulte form the second quantile regression on the crude oil inventory, GSCI and lagged premiums 40. Standard errors are bootstrapped with 500 repetitions}}{
\toprule
\multicolumn{8}{c}{Quantreg} \\
variable & $1-\alpha$ & Coefficient & Std.Error & t-stat & Pr$>$$|t|$ & \multicolumn{2}{c}{95\% CI} \\ 
  \midrule
Inventory & 0.01 & -0.79 & 0.63 & -1.27 & 0.21 & -1.81 & 0.98 \\ 
   & 0.05 & -1.24 & 0.27 & -4.60 & 0.00 & -1.52 & -0.68 \\ 
   & 0.1 & -0.42 & 0.23 & -1.87 & 0.06 & -0.84 & -0.13 \\ 
   & 0.5 & -0.55 & 0.16 & -3.47 & 0.00 & -0.86 & -0.20 \\ 
   & 0.9 & 0.37 & 0.18 & 2.04 & 0.04 & 0.06 & 0.63 \\ 
   & 0.95 & 0.01 & 0.29 & 0.04 & 0.97 & -0.51 & 0.75 \\ 
   & 0.99 & 0.49 & 0.40 & 1.22 & 0.22 & -1.77 & 1.06 \\ 
  GSCI & 0.01 & -0.30 & 0.35 & -0.88 & 0.38 & -1.33 & 0.54 \\ 
   & 0.05 & -0.62 & 0.25 & -2.46 & 0.01 & -0.99 & 0.04 \\ 
   & 0.1 & -0.11 & 0.20 & -0.56 & 0.58 & -0.47 & 0.27 \\ 
   & 0.5 & -0.55 & 0.14 & -3.86 & 0.00 & -0.82 & -0.23 \\ 
   & 0.9 & -0.45 & 0.19 & -2.33 & 0.02 & -1.01 & -0.14 \\ 
   & 0.95 & -0.85 & 0.37 & -2.33 & 0.02 & -1.85 & -0.05 \\ 
   & 0.99 & -2.18 & 0.46 & -4.79 & 0.00 & -3.59 & 0.02 \\ 
  LPremium40 & 0.01 & 0.17 & 0.09 & 1.98 & 0.05 & -0.05 & 0.36 \\ 
   & 0.05 & 0.16 & 0.05 & 2.89 & 0.00 & 0.09 & 0.27 \\ 
   & 0.1 & 0.13 & 0.04 & 2.93 & 0.00 & 0.07 & 0.20 \\ 
   & 0.5 & 0.08 & 0.03 & 2.61 & 0.01 & 0.02 & 0.13 \\ 
   & 0.9 & -0.07 & 0.05 & -1.38 & 0.17 & -0.13 & 0.05 \\ 
   & 0.95 & -0.10 & 0.06 & -1.67 & 0.10 & -0.25 & 0.01 \\ 
   & 0.99 & -0.08 & 0.07 & -1.14 & 0.25 & -0.21 & 0.11 \\ 
   \bottomrule
   }

Only the first table is placed on top of the page, with the second table on the middle of the next...... Do not understand why?

share|improve this question

1 Answer 1

Using the width (or the maxwidth) key you can specify the total width of your table; this requires using one or more X column specifier (from the tabularx package.) Please refer to the documentation of ctable and tabularx for further details.

You can use the \setupctable command to declare common options for all your ctables. A little example:

\documentclass{article}
\usepackage{ctable}                  
\usepackage{lipsum}% just to generate filler text

\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}

\setupctable{
 doinside=\small\renewcommand\arraystretch{1.2},
width=0.9\textwidth,
pos=ht
}    

\begin{document}

\ctable[caption=test one,pos=ht,]
{p{6cm}YYl}
{\tnote[]{note describing the table}}
{\lipsum[1] & col2a & col3a & col4a}

\ctable[caption=test two]
{p{6cm}YY}
{\tnote[]{note describing the table}}
{test text to show the constant width of the first column & column2a with some text & column3a}

\end{document}
share|improve this answer
    
! Undefined control sequence. l.7 \setupctable Do not understand why? –  latexmp Jun 7 '11 at 23:03
    
@latexmp: Most probably outdated package(s). Here's the version of ctable in my system: ctable.sty 2011/05/01 v1.19 ctable package. Update your package(s) if needed (meanwhile, you can specify the options for each ctable individually). –  Gonzalo Medina Jun 7 '11 at 23:15
    
ok will do. thnks. –  latexmp Jun 7 '11 at 23:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.