简体   繁体   中英

Latex indentation/centering in tables

Is it possible to set the centering of the individual rows with ctable, ie so that column 1 has left centering for the first 3 rows and then right centering for the last 5 rows?

On a more specific note--I´d like male/female and 1..3 in this table to be right aligned instead of left aligned whilst the rest of the variablenames remain left centered.

\documentclass[12pt]{article}
\usepackage{relsize}
\usepackage{setspace}
\usepackage{ctable}
\usepackage{Sweave}
\usepackage{amsmath,amsfonts,amssymb}
\begin{document}
    \ctable[ caption={ compldich }, label=z, pos=!tbp, ]{lcc} {\tnote[***]{P$<$0.001}\tnote[**]{P$<$0.01}\tnote[*]{P$<$0.05}} {\FL\multicolumn{1}{l}{Variable}&\multicolumn{1}{c}{Univariate}&\multicolumn{1}{c}{Multivariate}\NN
    \multicolumn{1}{l}{}&\multicolumn{1}{c}{Odds ratio}&\multicolumn{1}{c}{Odds ratio }\NN
    \ML
    Prom&1.071&0.77\NN
    & (0.739,1.557) & (0.568,1.034) \NN
    \NN
    Ag&0.987&0.989***\NN
    & (0.97,1.004) & (0.983,0.995) \NN
    \NN
    Gend&&\NN
    Male&1&1\NN
    \NN
    Fema&1.195&1.153\NN
    & (0.606,2.388) & (0.863,1.538) \NN
    \NN
    HSSE&&\NN
    1&1&1\NN
    \NN
    2&0.562&0.685\NN
    & (0.113,2.259) & (0.454,1.029) \NN
    \NN
    3&0.007***&0.019***\NN
    & (0,0.058) & (0.004,0.054) \NN
    \NN
    \FL
    }
\end {document}

您可以尝试将各个单元格放在一个盒子中,如下所示:

 Text & \ makebox [3 cm ][r]{ to the right } \NN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM