好吧,我已经为这张单表苦苦挣扎了很长时间。我想为患者创建一张漂亮的桌子,色彩鲜艳,很漂亮。我试图将文本集中起来,但是,我总是弄乱我创建的页面的几何形状。总结一下,我需要
- 将每个文本集中起来(我的意思是,我不希望文本位于每个单元格的顶部)。
- 用一条对角线将第一列和第一行分成两部分,这样我就可以写一段文字而不会打断序言中的所有结构。
- 在任何单元格内创建更多空间,以使文本不会显得紧凑。
- 是否可以使用颜色 airforceblue(我在序言中留下的)为该表创建双色线?
这是序言,我知道有很多命令对于这个问题来说不是必要的,但是我保留了它们,因为我不希望新命令影响我已经拥有的命令。
\documentclass[12pt, a4paper, english]{article}
\usepackage{graphicx} % Required for inserting images
\graphicspath{figures} % Path to images/figures
\usepackage{pgffor, ifthen}
\usepackage[table]{xcolor} % Pretty colours for tables
\usepackage{booktabs, caption}
\usepackage[table]{xcolor}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{tikzscale}
\usepackage{array}
\usepackage[english]{babel}
\usepackage{float}
\usepackage{fancyhdr}
\newcommand{\splitcell}[2]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
\newcolumntype{Z}{>{\raggedright}X}
\newcolumntype{M}[2]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{N}{@{}m{0pt}@{}}
\newcommand{\notes}[3][\empty]{
\noindent Add your comments here:\vspace{10pt}\\
\foreach \n in {1,...,#2}{
\ifthenelse{\equal{#1}{\empty}}
{\rule{#3}{0.5pt}\\}
{\rule{#3}{0.5pt}\vspace{#1}\\}
}
}
% Changes the layout and design of the pages
\usepackage{geometry}
\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=3cm, % Inner margin
outer=3cm, % Outer margin
bindingoffset=.5cm, % Binding offset
top=4.5cm, % Top margin
headheight=90pt,
bottom=2cm, % Bottom margin
% showframe, % Uncomment to show how the type block is set on the page
}
\setlength\parindent{0pt} % Removes all indentation from paragraphs
\addtolength{\textheight}{-78.7083pt}
%\setlength{\arrayrulewidth}{0.5mm}
%\setlength{\tabcolsep}{18pt}
%\renewcommand{\arraystretch}{2.5}
\pagestyle{fancy}
\fancyhf{}
\lhead{\begin{minipage}[c]{1cm}
%\includegraphics[width=1.5cm]{ENGLISHacupuntura.png}
\end{minipage}
\begin{minipage}[l]{5cm}
\scriptsize
%{\scriptsize Faculdade JK} \\
{\scriptsize Medical Business}
\end{minipage}
}
\rhead{\emptybox[3cm]{3cm}}
\rfoot{\scriptsize adress}
\newcommand{\HRule}{\rule{\linewidth}{0.05mm}}
\newcommand{\emptybox}[2][\textwidth]{
\begingroup
\setlength{\fboxsep}{-\fboxrule}
\noindent\framebox[#1]{\rule{0pt}{#2}}
\endgroup
}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0}
\definecolor{azure(web)(azuremist)}{rgb}{0.94, 1.0, 1.0}
\begin{document}
\section{\small Headache}
\begin{table}[ht]
\tiny
\centering
\resizebox{\columnwidth}{!}
{
\begin{tabular}{@{}c|c|c|c|c|c|@{}}
\cline{2-6} \rowcolor{aliceblue}
&Excess &Empty& \splitcell{Improvement \\ Factors} & \splitcell{Worsening \\ Factors}
&Nature \\[6pt]
\hline
\multicolumn{1}{|l|}{\splitcell{Frontal \\ (low intensity)}} & & & & & \\ \hline
\multicolumn{1}{|l|}{Vertex} & & & & & \\ \hline
\multicolumn{1}{|l|}{Frontal (high intensity)} & & & & & \\ \hline
\multicolumn{1}{|l|}{Sinus headache} & & & & & \\ \hline
\multicolumn{1}{|l|}{Catamenial} & & & & & \\ \hline
\multicolumn{1}{|l|}{Cluster headache} & & & & & \\ \hline
\multicolumn{1}{|l|}{Temporal headache} & & & & & \\ \hline
\multicolumn{1}{|l|}{Occipital neuralgia} & & & & & \\ \hline
\multicolumn{1}{|l|}{Parietal migraine} & & & & & \\ \hline
\end{tabular}
}
\end{table}
\end{document}
答案1
可能存在更高效的代码,但是这是我得到的。
\documentclass[12pt, a4paper, english]{article} \usepackage{graphicx} % Required for \usepackage{diagbox} \graphicspath{figures} % Path to images/figures \usepackage{pgffor, ifthen} \usepackage[table]{xcolor} % Pretty colours for tables \usepackage{booktabs, caption} \usepackage[table]{xcolor} \usepackage{nicematrix} \usepackage{amsmath} \usepackage{tikz} \usepackage{tikzscale} \usepackage{array} \usepackage[english]{babel} \usepackage{float} \usepackage{fancyhdr} \newcommand{\splitcell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}} \newcolumntype{Z}{>{\raggedright}X} \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}} \newcolumntype{N}{@{}m{0pt}@{}} \newcommand{\notes}[3][\empty]{
\noindent Add your comments here:\vspace{10pt}\\
\foreach \n in {1,...,#2}{
\ifthenelse{\equal{#1}{\empty}}
{\rule{#3}{0.5pt}\\}
{\rule{#3}{0.5pt}\vspace{#1}\\}
} } % Changes the layout and design of the pages \usepackage{geometry} \geometry{ paper=a4paper, % Change to letterpaper for US letter inner=3cm, % Inner margin outer=3cm, % Outer margin bindingoffset=.5cm, % Binding offset top=4.5cm, % Top margin headheight=90pt, bottom=2cm, % Bottom margin % showframe, % Uncomment to show how the type block is set on the page }
\setlength\parindent{0pt} % Removes all indentation from paragraphs \addtolength{\textheight}{-78.7083pt} %\setlength{\arrayrulewidth}{0.5mm} %\setlength{\tabcolsep}{18pt} %\renewcommand{\arraystretch}{2.5}
\NiceMatrixOptions {
custom-line =
{
command = ThickHline ,
ccommand = ThickNCLine ,
letter = I ,
tikz = { very thick, airforceblue }
} } %--------------------------------------------------------------------------------------------- \pagestyle{fancy} \fancyhf{} \lhead{\begin{minipage}[c]{1cm} \end{minipage} \begin{minipage}[l]{5cm} \scriptsize {\scriptsize Abbi Aled Acupuncture} \end{minipage} } \rhead{\emptybox[3cm]{3cm}}
\rfoot{\scriptsize adress}
\newcommand{\HRule}{\rule{\linewidth}{0.05mm}} \newcommand{\ThickHline}{\Hline[tikz={very thick, airforceblue}]} \newcolumntype{I}{|[tikz={very thick, airforceblue}]} \newcommand{\emptybox}[2][\textwidth]{ \begingroup \setlength{\fboxsep}{-\fboxrule} \noindent\framebox[#1]{\rule{0pt}{#2}} \endgroup } \definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66} \definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0} \definecolor{azure(web)(azuremist)}{rgb}{0.94, 1.0, 1.0}
%--------------------------------------------------------------------------------------------- % Begin of document %--------------------------------------------------------------------------------------------- \begin{document}
\begin{table}[H] \resizebox{\columnwidth}{!} { \setlength{\extrarowheight}{2mm} \begin{NiceTabular}{*{8}{c}}[hvlines,rules/color=white]% [code-before
=
\rowcolors{1}{white}{azure(web)(azuremist)}
\rowcolor{airforceblue}{1} % header colour ]\Hline[color=airforceblue] \Block[borders={tikz={color=airforceblue},left}]{}{} \diagbox{\textbf{\color{white}\centering\scriptsize Location}\\ \textbf{\color{white}\centering\scriptsize Intensity}}{\textbf{\color{white} \centering\scriptsize Patterns}\\ \textbf{\color{white}\centering\scriptsize 8 principles}} & \textbf{\color{white}\centering\scriptsize Excess} & \textbf{\color{white}\centering\scriptsize Empty}& \splitcell{\textbf{\color{white}\centering\scriptsize Improvement} \\ \textbf{\color{white}\centering\scriptsize Factors}} & \splitcell{\textbf{\color{white}\centering\scriptsize Worsening} \\ \textbf{\color{white}\centering\scriptsize Factors}} &\textbf{\color{white}\centering\scriptsize Nature } \Block[borders={tikz={color=airforceblue},right}]{}{} \\ \Hline[color=airforceblue]
\Block[borders={tikz={color=airforceblue},left}]{}{} {\splitcell{Frontal \\ (low intensity)}} \Block[borders={tikz={color=airforceblue},right}]{}{}& \Block[borders={tikz={color=airforceblue},right}]{}{}& \Block[borders={tikz={color=airforceblue},right}]{}{}& \Block[borders={tikz={color=airforceblue},right}]{}{}& \Block[borders={tikz={color=airforceblue},right}]{}{}& \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {Vertex}\Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {\splitcell{Frontal \\ (high intensity)}}\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {Sinus headache}\Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {Catamenial}\Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {Cluster headache}\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {Temporal headache}\Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {Occipital neuralgia}\Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\
\Block[borders={tikz={color=airforceblue},left}]{}{} {Parietal migraine}\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} &\Block[borders={tikz={color=airforceblue},right}]{}{} & \Block[borders={tikz={color=airforceblue},right}]{}{} \\ \Hline[color=airforceblue] \end{NiceTabular} } \end{table}
\end{document}