2009-06-28 22 views
1

我需要改變我的文檔的序言中更改表的樣子。 目前我所有的表都有字幕添加到底部,對準中心看上去像:「表N:表標題」。
我需要的是標題分成兩個部分並移動的話,那麼我的表看起來像:
表N(對齊到左)
表標題(對齊中心)
我應該添加到文檔序言來更改表浮動外觀?

哪有我做到這一點?

+0

是「表N」和字幕文本應該是在同一行?或者是「表N」本身?如果標題文本佔用多行,會發生什麼情況? – godbyk 2009-06-28 22:31:03

回答

4

像下面這樣可以工作,但你的描述留下了幾個問題,在我的腦海。

\documentclass{article} 

\usepackage{booktabs}% pretty rules for the table 

\usepackage{lipsum}% provides filler text 

%% Let's define our caption style 
\usepackage{caption} 

\DeclareCaptionLabelSeparator{fill-newline}{\hfill\null\par} 

\captionsetup{% 
    format=plain, 
    labelformat=simple, 
    labelsep=fill-newline, 
    singlelinecheck=false, 
    justification=centering, 
    position=top, 
} 

\begin{document} 

\lipsum[1] 

\begin{table}[h] 
    \caption{I've used the \texttt{caption} package to achieve this caption format.} 
    \centering 
    \begin{tabular}{ll} 
    \toprule 
    Option & Setting \\ 
    \midrule 
    format & plain \\ 
    labelformat & simple \\ 
    labelsep & fill-newline \\ 
    singlelinecheck & false \\ 
    justification & centering \\ 
    position & top \\ 
    \bottomrule 
    \end{tabular} 
\end{table} 

\lipsum[2] 

\end{document} 

caption包可以讓你重新設置字幕在幾乎你想要的任何方式。

  1. 你想要「表N」和標題文本在同一行或單獨的行(如上面)嗎?

  2. 應該如果字幕佔用多條線路發生什麼?

我可以用格式的更多撥弄如果這不是你想要什麼相當。如果您想在自己與ITI玩,檢查出caption package documentation