行颜色在乳胶中的多行表格上

[英]Rowcolor on a multirow tabular in LaTeX


So I tried learning LaTeX last night, and I trying to get this template for school assignments done ASAP. Part of that requires building a table. I want to use multirow, but need the multirows, that are acting like headings, to be colored gray. This is what I created so far from the almighty Google.

所以我昨天晚上试着学习乳胶,我试着尽快地把学校作业的模板做好。其中一部分需要建立一个表格。我想使用多行,但是需要多行,它们的作用就像标题一样,是灰色的。这是我从万能的谷歌创建的。

\documentclass{article}
\usepackage{xcolor,colortbl}
\begin{document}

\begin{tabular}{|l|l|p{5cm}|p{2.5cm}|l|l|}
\hline
\rowcolor{lightgray} 
Stage & Aim & Procedure & Materials & Focus & Time \\ 
\hline
\rowcolor{lightgray} 
\multicolumn{6}{|l|}{Engage} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
%\hline
\rowcolor{lightgray} \multicolumn{6}{|l|}{Study} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\rowcolor{lightgray} 
\multicolumn{6}{|l|}{Activate} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\rowcolor{lightgray} 
\multicolumn{6}{|l|}{Conclusion} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\end{tabular}

\end{document}

Unfortunately, this does not work with pdflatex version 1.4.0 on Debian GNU/Linux 5.0.4 (lenny) I have in a VM. Instead of doing it correctly, it ends up looking like this, where the first cell of the row after the multirow is blacked-out garbage.

不幸的是,这与Debian GNU/Linux 5.0.4 (lenny)中的pdflatex版本1.4.0不兼容。它不是正确地做,而是像这样,多行之后的第一个单元格是被黑掉的垃圾。

1 个解决方案

#1


9  

Try this:

试试这个:

\documentclass{article}

\usepackage{xcolor,colortbl}

\begin{document}

\begin{tabular}{|l|l|p{5cm}|p{2.5cm}|l|l|}

\hline
Stage & Aim & Procedure & Materials & Focus & Time \\ 
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Engage} \\ 
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Study} \\ 
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Activate} \\ 
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Conclusion} \\ 
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline

\end{tabular}

\end{document}

Which produces:

生产:

alt text http://img143.imageshack.us/img143/7486/texh.png

alt文本http://img143.imageshack.us/img143/7486/texh.png

EDIT:

编辑:

Yes, >{...} is the command to place your \columncolor in (must be in it!). Also see 4.1 from this PDF.

是的,> {…}是放置您的\columncolor的命令(必须在其中!)请参见本PDF中的4.1。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2010/04/08/23bc2b16c03ca294009a46d9a8e9408.html



猜您在找
latex 表格“tabular”跨多行笔记 用latex multirow包 绘制表格 Latex tabular和tabular* 注意表格样式参数命令 LATEX 强制multirow中内容居中 Latex 表格 多行多列
智能推荐
 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告