%20%E8%88%87%20%5Cvrule%20%E4%B8%8D%E7%AC%A6.png)
我不知道如何解決這個問題,其中\Xcline
from與我中設置的makecell
不相符(需要,因為實際的表格可能跨越幾頁)。\vrule
longtable
這是上述問題的 MWE:
\documentclass[11pt]{article}
\usepackage{longtable}
\usepackage{makecell}
\begin{document}
\begin{longtable}{c!{\vrule width 1.5pt}c!{\vrule width 1.5pt}c}
\Xcline{2-3}{1.5pt}
A & B & C \\
\Xcline{1-3}{1.5pt}
A & B & C \\
\Xcline{2-3}{1.5pt}
\end{longtable}
\end{document}
我遇到的問題是,最後一個 \Xcline 和 \vrule 之間的小方塊保持白色(我猜這是因為 \vrule 為水平線留下了空間,但 \Xcline 只是填充了單元格下方的空間- 但我真的不知道如何解決這個問題)。
我嘗試添加沒有\vrule
s 的額外表行,但這也不起作用。如果makecell
這是問題,如果有其他建議,我不介意切換到另一個包,我真的不需要任何其他makecell
功能。
答案1
你的桌子的背景不知道。然而,正如我在評論中所說,如果確實需要垂直線,我會再次考慮,即您不喜歡擁有專業外觀的表格(如給定連結中建議的那樣)...
假設您在整個表中需要這樣的規則,那麼以下建議可以幫助您:
\documentclass{article}
\usepackage{hhline,colortbl}
\begin{document}
\arrayrulewidth=1.5pt
\begin{tabular}{l | c | c }
\hhline{~|--}
1 & 2 & 3 \\
\hhline{-|--}
4 & 5 & 6 \\
\hhline{~|--}
\end{tabular}
\end{document}
答案2
下面的範例將為您指明正確的方向,因為它使用可全局應用的\arrayrulecolor
and\arrayrulewidth
命令將顏色與厚度結合 - 排列在範例中清晰可見
\documentclass{article}
\usepackage{hhline,colortbl}
\begin{document}
\arrayrulecolor{green}
\arrayrulewidth=2mm
\begin{tabular}{
!{\color{red}\vrule width 2pt}
l
|
c
!{\color{blue}\vrule width 2pt}
c
||
}
one & two & three\\
\hline
1 & 2 & 3\\%
\noalign{
\color{yellow}
\hrule height 5pt
}%
4&5&6\\
\hline
\end{tabular}
\end{document}
您可能還想看—https://tex.stackexchange.com/a/337790/197451
這符合您的要求嗎?
如果您認為答案符合您的要求,請點擊左側的紅色三角形及其下方的勾號來對答案進行投票
答案3
在 6.11 (2022-07-16) 版本中nicematrix
,可以定義與\cline
具有 Tikz 線條特徵的指令類似的指令(例如:使用 Tikz 鍵的厚度line width
)。
在下面的範例中,我還使用了 Tikz 鍵,shorten <
以便與粗體垂直線形成完美的連接。
\documentclass[11pt]{article}
\usepackage{nicematrix,tikz}
\begin{document}
\NiceMatrixOptions
{
custom-line =
{
letter = I ,
tikz = { line width = 1.5 pt } ,
total-width = 1.5pt
} ,
custom-line =
{
command = boldline ,
ccommand = cboldline ,
tikz = { line width = 1.5pt , shorten < = -1.5pt } ,
total-width = 1.5pt
}
}
\begin{NiceTabular}{cIcIcIc}[cell-space-limits=5pt]
\cboldline{2-3}
A & B & C & D\\
\cboldline{1-3}
A & B & C & D\\
\cboldline{2-3}
\end{NiceTabular}
\end{document}
您需要多次編譯(因為使用了 PGF/Tikz 節點nicematrix
)。