0

Well, I have been struggling for a long time with this single table. I would like to create a fancy table for the patients, colored and beautiful. I tried to centralize the text, however, I am always making a mess with the geometry of the page I created. To summarize I need to

  1. Centralize every text (I mean, I do not want the text in the top of every cell).
  2. Divide the first column and line into two with a diagonal line where I can write a text without interrupting all the structure in the preamble.
  3. Create more space inside any cells in order to the text does not appear tight.
  4. It is possible to create double-colored lines for this table using the color airforceblue (I left in the preamble)?

Here is the preamble, I know there are a lot of commands that are not necessary for this problem, but I left them because I do not want that the new command affects the commands I already have.

\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}

enter image description here

  • The diagonal has been covered previously (see https://tex.stackexchange.com/questions/17745/diagonal-lines-in-table-cell for example). See the array package m column type. See also https://tex.stackexchange.com/questions/466558/table-background-rule-color – John Kormylo Feb 24 '24 at 14:54
  • Hi, @JohnKormylo thanks for your comment. I got something near to what I wanted. However, I am sure there is a "clean" latex code. I still have problems with the size of the text. I do not think is beautiful in this size and it is not as centered as I wished, lol. Although, I owe you a thank you. – Francesca Feb 24 '24 at 23:02

1 Answers1

1

Might exists even more efficient code, however here is what I got.

enter image description here

\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}

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. – Community Feb 25 '24 at 11:24