防止 lyx 中的子表标题换行

防止 lyx 中的子表标题换行

替代文本

有人能给我提供一个优雅的解决方案来防止 lyx 中的表格标题换行吗?它必须在行尾换行,而不是在表格末尾换行。

%% LyX 1.6.7 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{babel}

\begin{document}
%
\begin{table}
\caption{Valleys in promoters of genes correlated with overexpression by breast
cancer subtype}


\label{tab:vlyTallyUniqVlyMtchCntrlOvrExp}

\subtable[Number of valleys in the promoter region marking overexpresses
genes in breast cancer by subtype]{

\label{tab:vlyTallyUniqCombinedVlyMtchCntrlOvrExp}

\begin{tabular}{|c|c|c|c|}
\cline{3-4} 
\multicolumn{1}{c}{} &   & \multicolumn{2}{c|}{Over-expression}\tabularnewline
\cline{3-4} 
\multicolumn{1}{c}{} &  & Basal & Luminal \tabularnewline
\hline 
Marked & Basal  & 131  & 116\tabularnewline
\cline{2-4} 
Cell line & Luminal  & 100  & 104\tabularnewline
\hline
\end{tabular}

}
\end{table}


%
\begin{table}
\subtable[Directly overlapping valleys in promoters of genes correlated
with overexpression by breast cancer subtype]{

\label{tab:vlyTallyUniqOverlappingVlyMtchCntrlOvrExp}

\begin{tabular}{|c|c|c|c|}
\cline{3-4} 
\multicolumn{1}{c}{} &   & \multicolumn{2}{c|}{Over-expression}\tabularnewline
\cline{3-4} 
\multicolumn{1}{c}{} &  & Basal & Luminal \tabularnewline
\hline 
Marked & Basal  & 26 & 18\tabularnewline
\cline{2-4} 
Cell line & Luminal  & 20 & 10\tabularnewline
\hline
\end{tabular}

}
\end{table}

\end{document}

答案1

使用包subfigcaption

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{subfig}
\usepackage{caption}
\captionsetup[table]{position=top,width=\textwidth}

\begin{document}
%
\begin{table}
\caption{Valleys in promoters of genes correlated with overexpression by breast
cancer subtype}\label{tab:vlyTallyUniqVlyMtchCntrlOvrExp}
\centering
\subfloat[Number of valleys in the promoter region marking overexpresses
genes in breast cancer by subtype]{\label{tab:vlyTallyUniqCombinedVlyMtchCntrlOvrExp}
\begin{tabular}{|c|c|c|c|}
\cline{3-4} 
\multicolumn{1}{c}{} &   & \multicolumn{2}{c|}{Over-expression}\tabularnewline
\cline{3-4} 
\multicolumn{1}{c}{} &  & Basal & Luminal \tabularnewline
\hline 
Marked & Basal  & 131  & 116\tabularnewline
\cline{2-4} 
Cell line & Luminal  & 100  & 104\tabularnewline
\hline
\end{tabular}}

\subfloat[Directly overlapping valleys in promoters of genes correlated
with overexpression by breast cancer subtype]{\label{tab:vlyTallyUniqOverlappingVlyMtchCntrlOvrExp}
\begin{tabular}{|c|c|c|c|}
\cline{3-4} 
\multicolumn{1}{c}{} &   & \multicolumn{2}{c|}{Over-expression}\tabularnewline
\cline{3-4} 
\multicolumn{1}{c}{} &  & Basal & Luminal \tabularnewline
\hline 
Marked & Basal  & 26 & 18\tabularnewline
\cline{2-4} 
Cell line & Luminal  & 20 & 10\tabularnewline
\hline
\end{tabular}}
\end{table}

\end{document}

替代文本

答案2

使用/my subcaption 包而不是 subfig,可以使用 \subcaptionbox 的可选参数来扩大子图的宽度,以便使用整个页面宽度。示例代码:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\usepackage{caption,subcaption}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{babel}

\begin{document}
%
\begin{table}
\caption{Valleys in promoters of genes correlated with overexpression by breast
cancer subtype}

\label{tab:vlyTallyUniqVlyMtchCntrlOvrExp}

\subcaptionbox{%
Number of valleys in the promoter region marking overexpresses genes in breast cancer by subtype
\label{tab:vlyTallyUniqCombinedVlyMtchCntrlOvrExp}}
[\linewidth]
{%
\begin{tabular}{|c|c|c|c|}
\cline{3-4} 
\multicolumn{1}{c}{} &   & \multicolumn{2}{c|}{Over-expression}\tabularnewline
\cline{3-4} 
\multicolumn{1}{c}{} &  & Basal & Luminal \tabularnewline
\hline 
Marked & Basal  & 131  & 116\tabularnewline
\cline{2-4} 
Cell line & Luminal  & 100  & 104\tabularnewline
\hline
\end{tabular}

}
\end{table}


%
\begin{table}
\subcaptionbox{%
Directly overlapping valleys in promoters of genes correlated
with overexpression by breast cancer subtype
\label{tab:vlyTallyUniqOverlappingVlyMtchCntrlOvrExp}}
[\linewidth]
{%
\begin{tabular}{|c|c|c|c|}
\cline{3-4} 
\multicolumn{1}{c}{} &   & \multicolumn{2}{c|}{Over-expression}\tabularnewline
\cline{3-4} 
\multicolumn{1}{c}{} &  & Basal & Luminal \tabularnewline
\hline 
Marked & Basal  & 26 & 18\tabularnewline
\cline{2-4} 
Cell line & Luminal  & 20 & 10\tabularnewline
\hline
\end{tabular}

}
\end{table}

\end{document}

(不幸的是,我对 Lyx 一无所知,所以我不知道如何将其移植到 Lyx。)

要查看带有子图的更多奇特内容,请查看 floatrow 包。

相关内容