\documentclass[a4paper]{ctexart}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{makecell}
\usepackage{array}
\usepackage{longtable}

\begin{document}
\begin{tabular}{c|c|c|c|c|c}
\hline
\rowcolor{yellow} 检测基因&NFE2L2&NQO1&SOD2&CAT&\
\hline
\multicolumn{6}{c}{}
\ \hline
\rowcolor{yellow} 结 果&TT&GG&AA&CC&\
\hline
\end{tabular}
\end{document}

这是我的代码

只能做成这样,两边不能圆圆的
谢谢各位大佬

3 回答3

4
%mwe_tabular.tex \documentclass[a4paper]{ctexart} \usepackage{colortbl} \usepackage{xcolor} \usepackage{makecell} \usepackage{array} \usepackage{longtable} \usepackage{tcolorbox} \tcbuselibrary{skins, vignette, raster, listings, theorems, breakable, magazine, poster, fitting, hooks, xparse, external, documentation, } \usepackage{tikz} \begin{document} ![](/static/images/ext/pdf.gif)<a href="https://static.latexstudio.net/data/attach/201911/83126fb9457cf90.pdf" target="_blank">mwe_tabular.pdf</a>\noindent \begin{tabular}{c} \tcbset{enhanced,fonttitle=\bfseries\large,fontupper=\normalsize\sffamily} \begin{tcolorbox}[arc=4mm,colback=yellow, tabulars={c|c|c|c|c|c},width=0.8\linewidth] 检测基因&NFE2L2&NQO1&SOD2&CAT&\\ \end{tcolorbox}\\ \multicolumn{1}{c}{}\\ \tcbset{enhanced,fonttitle=\bfseries\large,fontupper=\normalsize\sffamily} \begin{tcolorbox}[arc=4mm,colback=yellow, tabulars={c|c|c|c|c|c},width=0.8\linewidth] 结 果&TT&GG&AA&CC&\\ \end{tcolorbox} \end{tabular} \end{document} ![](/static/images/ext/pdf.gif)<a href="https://static.latexstudio.net/data/attach/201911/83126fb9457cf90.pdf" target="_blank">mwe_tabular.pdf</a>

回答: 2019-11-14 12:39

%mwe_tabular.tex \documentclass[a4paper]{ctexart} \usepackage{colortbl} \usepackage{xcolor} \usepackage{makecell} \usepackage{array} \usepackage{longtable} \usepackage{tcolorbox} \tcbuselibrary{skins, vignette, raster, listings, %listingsutf8, %minted, theorems, breakable, magazine, poster, fitting, hooks, xparse, external, documentation, } \usepackage{tikz} \begin{document} \begin{comment} \begin{tabular}{c|c|c|c|c|c} \hline \rowcolor{yellow} 检测基因&NFE2L2&NQO1&SOD2&CAT&\\ \hline \multicolumn{6}{c}{}\\ \hline \rowcolor{yellow} 结 果&TT&GG&AA&CC&\\ \hline \end{tabular} \end{comment} \noindent \begin{tabular}{c} \begin{tcolorbox}[arc=3mm,colback=yellow, tabulars={c|c|c|c|c|c},width=0.7\linewidth] 检测基因&NFE2L2&NQO1&SOD2&CAT&\\ \end{tcolorbox}\\ \multicolumn{1}{c}{}\\ \begin{tcolorbox}[arc=3mm,colback=yellow, tabulars={c|c|c|c|c|c},width=0.45\linewidth] 结 果&TT&GG&AA&CC&\\ \end{tcolorbox} \end{tabular} \end{document} ![](/static/images/ext/pdf.gif)mwe_tabular.pdf

回答: 2019-11-14 13:44

%mwe_tabular.tex \documentclass[a4paper]{ctexart} \usepackage{comment} \usepackage{colortbl} \usepackage{xcolor} \usepackage{makecell} \usepackage{array,tabularx} \usepackage{longtable} \usepackage[left=1.5cm,right=1.5cm]{geometry} \usepackage{tcolorbox} \usepackage{tikz} \begin{document} \noindent \begin{tabular}{c} \begin{tcolorbox}[arc=3mm,colback=yellow, tabularx={X|X|X|X|X|X},width=0.9\linewidth] 检测基因&NFE2L2&NQO1&SOD2&CAT&\\ \end{tcolorbox}\\ \multicolumn{1}{c}{}\\ \begin{tcolorbox}[arc=3mm,colback=yellow, tabularx={X|X|X|X|X|X},width=0.9\linewidth] 结 果&TT&GG&AA&CC&\\ \end{tcolorbox} \end{tabular} \end{document} ![](/static/images/ext/pdf.gif)mwe_tabular.pdf

回答: 2019-11-14 16:31

\input{preamble_QQ2019.tex} %主要是增加了tikz宏包,填加了 shapes.multipart库. \begin{document} \begin{tikzpicture} [every node/.style={rounded corners=8pt,text width=1.5cm, draw, anchor=text,rectangle split,rectangle split horizontal,rectangle split parts=6,fill=yellow}] \node at(0,0) {检测基因 \nodepart{two}NFE2L2 \nodepart{three}NQO1 \nodepart{four}SOD2 \nodepart{five}CAT \nodepart{six}}; \node at(0,-1cm){\hfil 结\hspace{\ccwd}果\hfil \nodepart{two}TT \nodepart{three}GG \nodepart{four}AA \nodepart{five}CC \nodepart{six}}; \end{tikzpicture} %\end{comment} \end{document} ![](/static/images/ext/pdf.gif)mwe_tabular.pdf

回答: 2019-11-14 16:39

最后一个办法的导言内容: \documentclass[a4paper]{ctexart} \usepackage{comment} \usepackage{xcolor} \usepackage{tikz} \usetikzlibrary{shapes,shapes.multipart}
  • 用tikz宏包画了一下,可以参考!我认为这个办法可行。 – WoodMan 2019-11-14 16:32 回复
  • 好的 谢谢大神 比个心 – timoabe 2019-11-14 14:39 回复
  • 我的做法,事实上是,一行一个表。这也就是效果不太完美的原因吧。 – WoodMan 2019-11-14 13:50 回复
  • 关键点是 一个表的每一行都是左弧线开始,而右弧线结束,这是关键。在已有的表格宏包中,我再找一下看是否有这样的宏包。 – WoodMan 2019-11-14 13:49 回复
  • 以上用tcolorbox宏进行了实现,你看一下能不能用。不过,我感觉,效果都不够完美! – WoodMan 2019-11-14 13:46 回复
2
仍然是一个用 `tcolorbox` 的方案,做了一定的抽象。凑合吧 如果完全使用表格来做,需要 patch 很底层的实现。 ```tex \documentclass{ctexart} \usepackage[table]{xcolor} % load colortbl package \usepackage{tcolorbox} \tcbuselibrary{hooks} % allow use of option "before upper pre" \makeatletter \tcbset{ rounded tabular/.style={ tabulars={*{5}{c|}}, % preamble of "{tabular*}" env colback=magenta!30, % background color arc=0.8em, % radius of arc, magic number width=0.8\linewidth, % total width set all rules=0.6pt % width of frame rule and tabular vrule }, set all rules/.style={ boxrule=#1, before upper pre={% \setlength{\arrayrulewidth}{#1}% } } } \makeatother \newtcolorbox{rtabular}[1][]{ rounded tabular/.append style={#1}, rounded tabular } \begin{document} \tcbset{ rounded tabular/.append style={ tabulars={ *{2}{>{\centering}p{4em}|} *{3}{>{\centering}p{3em}|} }, width=0.9\linewidth, set all rules=0.6pt } } \begin{rtabular} 检测基因 & NFE2L2 & NQO1 & SOD2 & CAT \end{rtabular} \begin{rtabular} 检\qquad 因 & NFE & NO & SO & C \end{rtabular} \end{document} ``` ![](https://pics.latexstudio.net/data/images/201911/97303eb2a3966c7.png)
0
建议使用tcolorbox宏包实现,在命令行用`texdoc tcolorbox`打开其说明书,用`Ctrl F`以`tabular`为关键字进行搜索,基本能满足你的需求。
  • 嗯嗯 好的我去看一下 谢谢 – timoabe 2019-11-14 14:39 回复

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。