2010-04-08 6 views
7

어젯밤에 LaTeX을 배우려고했지만 최대한 빨리 완료된 학교 과제를 위해이 템플릿을 얻으려고했습니다. 그 중 일부는 테이블을 만들어야합니다. 다중 행을 사용하고 싶지만 표제처럼 작동하는 다중 행이 필요합니다. 회색으로 표시됩니다. 이것이 제가 전능하신 구글에서 지금까지 창조 한 것입니다.LaTeX에서 다중 행 표에 Rowcolor

\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} 

불행하게도,이 데비안 GNU/리눅스 5.0.4 (레니)에 pdflatex 버전 1.4.0 나는 VM에서이 작동하지 않습니다. 올바르게 수행하는 대신, this과 같이 보입니다. 다중 행 다음 행의 첫 번째 셀은 검게 나간 쓰레기입니다.

+0

나는이 질문을 tex.stackexchange.com으로 옮겨야한다고 생각한다. –

+0

당시 Tex SE는 존재하지 않았지만 나는 잘못 될 수 있었다. 나는 그것을 이후에 사용하기 시작했다. – songei2f

답변

9

이 시도 :

\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} 

생산 어떤 :

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

편집 :

예, >{...}가 배치 명령이 당신의 \columncolor에서 (그 안에 있어야합니다 !). this PDF에서 4.1을 참조하십시오.

+0

당신, 선생님, 오늘 내 영웅입니다. 그 명령이나 무엇인가를 포함하려면'>'가 필요합니까? 오 LaTeX, 나는 당신을 더 잘 이해했으면 좋겠다! – songei2f

+0

@alharaka, :) 오신 것을 환영합니다. 내 편집을 참조하십시오. –

+1

@BartKiers pdf 링크가 죽어있는 것 같습니다. 업데이트 할 기회가 있으십니까? :) – radek