English 中文(简体)
• 如何将囚室与LaTeX的多行合并?
原标题:How to merge cells with multirow in LaTeX?
  • 时间:2016-07-26 14:34:37
  •  标签:
  • latex

我有以下法典:

egin{table}[ht]

egin{center}
egin{tabular}{ | l | l | l | l | l | l | l | }
hline
    multirow{2}{*}{Oprava} & multirow{2}{*}{zkratka} & multirow{2}{*}{alg.} & chybovost \% &  &  &  \ hline
     &  &  & MAE & RSE & RMSE & RRSE \ hline
    velikosti & vel. & NBM &  &  &  &  \ hline
     &  & c4.5 &  &  &  &  \ hline
     &  & kNN &  &  &  &  \ hline
     &  & SMO &  &  &  &  \ hline
    bilateralne & bilat. & NBM &  &  &  &  \ hline
     &  & c4.5 &  &  &  &  \ hline
     &  & kNN &  &  &  &  \ hline
     &  & SMO &  &  &  &  \ hline
    oprava & zkratka & NBM &  &  &  &  \ hline
     &  & c4.5 &  &  &  &  \ hline
     &  & kNN &  &  &  &  \ hline
     &  & SMO &  &  &  &  \ hline
    oprava & zkratka & NBM &  &  &  &  \ hline
     &  & c4.5 &  &  &  &  \ hline
     &  & kNN &  &  &  &  \ hline
     &  & SMO &  &  &  &  \ hline
end{tabular}
end{center}

caption{Multi-row table}
label{tab:multicol}
end{table}

And what I get is this: LaTeX output

我需要合并这些囚室,以便案文不会被删除。 重复计算法名称——NBM、kNN等——的行文相同。 Pls帮助。

增 编

最佳回答

解决你的问题非常简单。 您应使用<代码>cline{4-7}而不是hline。 姓名:hline在表格完整宽度上规定一个横向线,而cline{4-7}则仅从第4栏到第7栏之间划出一个横向线,从而不跨越第1栏。

为了将案文放在重整和合并的重复词前面,你可以使用<代码>多功能{},再与<代码>cline{}结合使用。 https://en.wikibooks.org/wiki/LaTeX/Tables“rel=“noretinger”>。

该守则的例子如下:

egin{table}[]
centering
caption{My caption}
label{my-label}
egin{tabular}{|l|l|l|l|l|l|l|}
hline
multirow{2}{*}{Oprave} & multirow{2}{*}{Zkratka} & multirow{2}{*}{Alg.} & multicolumn{4}{l|}{Chybovost \%} \ cline{4-7} 
  &  &  & MAE & RSE & RMSE & RRSE \ hline
multirow{4}{*}{velikosti} & multirow{4}{*}{vel.} & NBM &  &  &  &  \ cline{3-7} 
 &  & c4.5 &  &  &  &  \ cline{3-7} 
 &  & kNN &  &  &  &  \ cline{3-7} 
 &  & SMO &  &  &  &  \ hline
multirow{4}{*}{bilateralne} & multirow{4}{*}{bilat.} & NBM &  &  &  &  \ cline{3-7} 
 &  & c4.5 &  &  &  &  \ cline{3-7} 
 &  & kNN &  &  &  &  \ cline{3-7} 
 &  & SMO &  &  &  &  \ hline
multirow{4}{*}{oprava} & multirow{4}{*}{zkratka} & NBM &  &  &  &  \ cline{3-7} 
 &  & c4.5 &  &  &  &  \ cline{3-7} 
 &  & kNN &  &  &  &  \ cline{3-7} 
 &  & SMO &  &  &  &  \ hline
multirow{4}{*}{oprava} & multirow{4}{*}{zkratka} & NBM &  &  &  &  \ cline{3-7} 
 &  & c4.5 &  &  &  &  \ cline{3-7} 
 &  & kNN &  &  &  &  \ cline{3-7} 
 &  & SMO &  &  &  &  \ hline
end{tabular}
end{table}

成果如下:

“Result”/

Note: if you have struggles with table generation, or you want a more quick way to easily make tables as you would do in Excel, you can use an online table generator for Latex. I often use http://www.tablesgenerator.com/

问题回答

I m sorry I m posting this as answer but this is new account so I can t comment. I wanted to ask what package do you use that adds multirow command because for my LaTeX it s an unknown command





相关问题
Effective Version Control for Slides

I have to maintain a huge set of training material in forms of slides. At a first glance, I ve noticed there s no support for version control in OpenOffice OOImpress (but I might be wrong on this). ...

Maths in LaTex table of contents

I am trying to add a table of contents for my LaTex document. The issue I am having is that this line: subsubsection{The expectation of (X^2)} Causes an error in the file that contains the ...

Using vim s `gqap sometimes indents unusually

For the life of me, I cannot figure out the cause of this: when writing in LaTeX documents, I like to keep my line width to maximum of 80 characters. As such, I will execute the vim command gqap and ...

aligning math equations in Latex

I am trying to align the following equations around the equal sign. What can I do? Thanks! I am using the AMSMath package $$mddot{x}_{1}-K(x_{2}+x_{12})+C(dot{x}_{12}+dot{x}_{2})+2Cdot{x}_{1} ...

LaTeX output does not update

I have just begun using LaTeX. I am working in Windows and am using TeXnicCenter as my editor. When I build and output, having the following code: documentclass{article} egin{document} This is a ...

How to put line break in a math

I d like to express the following sentence (source_location is also italic, it s not correctly rendered): Each entry has a list of tuple: < source_location, R/W, trip_counter, occurrence, killed ...

热门标签