嗨,我对 LaTeX 还很陌生。我昨天才开始学习,我的计划是将我们的医疗报告从设计重新创建PDF
为动态LaTeX
PDF
。
我的问题是在第 1 列和第 2 列之间创建这些半垂直线(见下文)
我所说的半垂直是指:
1 2 3
A | B | C
D | E | F
垂直线彼此不相接,且页眉没有任何线条。
我还想让现有的边缘更圆润,但中间的线条不在它应该在的位置。我也无法给它们添加颜色。
这是我到目前为止所取得的成就:
\documentclass[12pt]{article}
\usepackage{rotating}
\usepackage[utf8]{inputenc}
\usepackage[default]{lato}
\usepackage[T1]{fontenc}
\usepackage{pbox}
\usepackage{booktabs}
\usepackage{tcolorbox}
\usepackage{lipsum}
\tcbuselibrary{fitting}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{0.2}
\begin{tabular}{c@{\hskip 0mm}c@{\hskip 0mm}c@{\hskip 0mm}c}
\\
\begin{tcolorbox}[colframe=white,colback=airforceblue!10!white, sharp corners,
rounded corners=north, height=15mm, width=30mm, valign=center, halign=center] GENE \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=airforceblue!10!white, sharp corners,
rounded corners=north, height=15mm, width=30mm, valign=center, halign=center] REGIÃO GÊNICA \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=airforceblue!10!white, sharp corners,
rounded corners=north, height=15mm, width=30mm, valign=center, halign=center] HÁ \\ MUTAÇÃO? \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=airforceblue!10!white, sharp corners,
rounded corners=north, height=15mm, width=30mm, valign=center, halign=center] NOTAÇÃO \end{tcolorbox} &
\\
\begin{tcolorbox}[colframe=white,colback=white, height=6mm, width=30mm,
valign=center, halign=center] KRAS \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=white, height=6mm, width=30mm,
valign=center, halign=center] Exons 2 e 3 \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=white, height=6mm, width=30mm,
valign=center, halign=center] Não \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=white, height=6mm, width=30mm,
valign=center, halign=center] - \end{tcolorbox}
\\ \hline
\begin{tcolorbox}[colframe=white,colback=white, height=6mm, width=30mm,
valign=center, halign=center] NRAS \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=white, height=6mm, width=30mm,
valign=center, halign=center] Exons 2 e 3 \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=white,height=6mm, width=30mm,
valign=center, halign=center] Sim \end{tcolorbox} &
\begin{tcolorbox}[colframe=white,colback=white,height=6mm, width=30mm,
valign=center, halign=center] c.181C>A \\ p.Q61K \end{tcolorbox}
\\
\end{tabular}
\end{center}
\end{document}
只是为了解释我的代码。我需要框具有分隔大小。它们不能随着文本的输入而变化。我需要单独管理每个框的大小。其中一些框的宽度大小不一样。
我知道我的编码不好。我是初学者,R
完全没有经验LaTeX
。我认为在一天的学习中我做得还不错。
我在论坛上搜索了很长时间,寻找垂直半线。如果您能帮助我,请告诉我。
答案1
警告,我已经改变了颜色,以使图像在屏幕上更容易识别。
我的第一个想法是:这不是tcbraster
一张桌子,而是一个东西。
不过,我提供了两种解决方案,一种是使用常规表格,另一种是使用tcbraster
。
OP 认为一个主要问题是垂直线。tcolorbox
提供borderline
可以单独设置到盒子任何一侧的功能,具有各种 Ti钾基于 Z 的样式。
两者基本上都使用特殊\newtcolorbox
框作为标题框和普通“单元格”框。
在该方法中很难适应垂直间距tabular
,使用tcbraster
和raster row skip
值更容易实现。但是,\hline
在那里不起作用,但可以使用multicolumn
光栅框来伪造,并包含在\fakehline
命令中。
\documentclass[12pt]{article}
\usepackage{rotating}
\usepackage[utf8]{inputenc}
\usepackage[default]{lato}
\usepackage[T1]{fontenc}
\usepackage{pbox}
%\usepackage{booktabs}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\newtcolorbox{tableheaderbox}[1][]{
colback={white!30!blue},
colframe={white},
nobeforeafter,
sharp corners,
arc=6mm,
rounded corners=north,
height=15mm,
width=30mm,
valign=center,
halign=center,
equal height group=tableheader,
#1}
\newtcolorbox{contentbox}[1][]{%
enhanced jigsaw,
boxrule=0pt,
colback=white,
width=30mm,
valign=center,
halign=center,
after={},
borderline vertical={2pt}{1pt}{red,opacity=0.4},
equal height group=contentboxes,
#1
}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{0.2}
% Headerboxes
\begin{tabular}{*{4}{@{}c@{}}}
\begin{tableheaderbox}
GENE
\end{tableheaderbox} &
\begin{tableheaderbox}
REGIÃO GÊNICA%
\end{tableheaderbox} &
\begin{tableheaderbox}
HÁ \\ MUTAÇÃO?
\end{tableheaderbox} &
\begin{tableheaderbox}
NOTAÇÃO
\end{tableheaderbox}
\tabularnewline
% Contentboxes
\begin{contentbox}
KRAS
\end{contentbox}&
\begin{contentbox}
Exons 2 e 3%
\end{contentbox}&
\begin{contentbox}
Não%
\end{contentbox}&
\begin{contentbox}
-%
\end{contentbox}
\tabularnewline
%\hline
\begin{contentbox}
NRAS
\end{contentbox}&
\begin{contentbox}
Exons 2 e 3
\end{contentbox}&
\begin{contentbox}
Sim
\end{contentbox}&
\begin{contentbox}
c.181C>A \\ p.Q61K
\end{contentbox}
\tabularnewline
\end{tabular}
\end{center}
\end{document}
版本tcbraster
\documentclass[12pt]{article}
\usepackage{rotating}
\usepackage[utf8]{inputenc}
\usepackage[default]{lato}
\usepackage[T1]{fontenc}
\usepackage{pbox}
\usepackage{booktabs}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\newtcolorbox{tableheaderbox}[1][]{
colback={white!30!blue},
colframe={white},
sharp corners,
arc=6mm,
beforeafter skip={0.5ex},
rounded corners=north,
height=15mm,
width=30mm,
valign=center,
halign=center,
equal height group=tableheader,
#1}
\newtcolorbox{contentbox}[1][]{%
enhanced jigsaw,
boxrule=0pt,
colback=white,
width=30mm,
valign=center,
halign=center,
equal height group=contentboxes,
box align=center,
sharp corners,
borderline vertical={2pt}{1pt}{red,opacity=0.4},
#1
}
\newtcolorbox{rulerbox}[1][]{raster multicolumn=4,
size=minimal,
height=0pt,
enhanced jigsaw,
sharp corners,
borderline horizontal={0.5pt}{0pt}{black},
nobeforeafter,
#1}
\newcommand{\fakehline}[1][]{%
\begin{rulerbox}[#1]
\end{rulerbox}
}
\begin{document}
\begin{center}
% Headerboxes
\begin{tcbraster}[raster columns=4,raster row skip=2pt]
\begin{tableheaderbox}
GENE
\end{tableheaderbox}
\begin{tableheaderbox}
REGIÃO GÊNICA%
\end{tableheaderbox}
\begin{tableheaderbox}
HÁ \\ MUTAÇÃO?
\end{tableheaderbox}
\begin{tableheaderbox}
NOTAÇÃO
\end{tableheaderbox}
\begin{contentbox}
KRAS
\end{contentbox}
\begin{contentbox}
Exons 2 e 3%
\end{contentbox}
\begin{contentbox}
Não%
\end{contentbox}
\begin{contentbox}
-%
\end{contentbox}
\fakehline
\begin{contentbox}
NRAS
\end{contentbox}
\begin{contentbox}
Exons 2 e 3
\end{contentbox}
\begin{contentbox}
Sim
\end{contentbox}
\begin{contentbox}
c.181C>A \\ p.Q61K
\end{contentbox}
\fakehline
\end{tcbraster}
\end{center}
\end{document}