我使用的是 TeXLive 2011,我的一个朋友在创建表格时遇到了问题,表格使用了固定大小的居中\multirow
和\multicolumn
单元格。这是他的论文,因此在下面的最小工作示例中有很多可忽略的代码,但我不确定。
\documentclass[11pt,titlepage,oneside,fleqn]{report}
\usepackage[a4paper,right=1.0in,left=1.0in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}
\usepackage{ifthen}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage{changepage}
\usepackage{textcomp}
\usepackage[version=3]{mhchem}
\usepackage{tipa}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{chemfig}
\usepackage{longtable}
\usepackage{xtab}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{fmtcount}
\interfootnotelinepenalty=10000
\linespread{1.3}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\hyphenation{ImageJ}
\frenchspacing
\sloppy
\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
\def\makebraces[#1,#2]#3#4#5{%
\edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
\edef\delimvshift{\the\dimexpr(#1-#2)/2}%
\chemmove{%
\node[at=(#4),yshift=(\delimvshift)]
{$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim
width0pt\right.$};%
\node[at=(#5),yshift=(\delimvshift)]
{$\left.\vrule height\delimhalfdim depth\delimhalfdim
width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$};}}
\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}}
\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}}
\begin{document}
\makeatletter
\renewcommand{\@makechapterhead}[1]{%
\vspace*{50 pt}%
{\setlength{\parindent}{0pt} \raggedright \normalfont
\bfseries\Huge\thechapter.\ #1
\par\nobreak\vspace{40 pt}}}
\makeatother
\begin{table}[h]
\hspace{-1,25cm}
\begin{tabular}{>{\centering\arraybackslash}m{2cm} >{\centering\arraybackslash}m{3cm} >{\centering\arraybackslash}m{2cm} >{\centering\arraybackslash}m{4cm} >{\centering\arraybackslash}m{4cm}}
\hline
\noalign{\smallskip}
\multirow{3}{*}{A brmfe juiodondf} & \multicolumn{2}{c}{Az előkezelt otijgfni} & \multirow{3}{*}{A oighderinir, iufbdgkfddf and zxdbviid7ud uibuofvdt water dfubu} & \multirow{3}{*}{Absorbance 550~nm (liquid shit)}\\\noalign{\smallskip}
\cline{2-3} \noalign{\smallskip}
& what & whatever & &\\\noalign{\smallskip}
\cline{2-3} \noalign{\smallskip}
& \multicolumn{2}{c}{something}\\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
x & 0,71g & 0,0360g & 15ml & 0,4\\\noalign{\smallskip}
y & 0,11g & 0,0146g & 15ml & 0,26\\\noalign{\smallskip}
z & 0,47g & 0,0527g & 16ml & 0,5\\\noalign{\smallskip}
\multicolumn{4}{l}{again some} & 0,537\\\noalign{\smallskip}
\multicolumn{4}{l}{bullshit} & 0,456\\
\noalign{\smallskip}
\hline
\end{tabular}
\caption{Beautiful table}
\end{table}
\end{document}
答案1
如果问题出在换行上,那是因为你*
为 multirow 命令提供了参数。这告诉它使用文本的自然宽度。但是,你对列使用了有限的宽度,如果你设置该宽度而不是,*
你会看到文本在列内换行。