4

Hi I'm really new to LaTeX. I've started learning yesterday and my plan is to recreate our medical reports from a design PDF to dynamic LaTeX PDF.

My problem is to create these semi-vertical lines between the column 1 and 2 (see below)

What I mean with semi-vertical:

1 2 3

A | B | C

D | E | F

The vertical lines does not touch each other, and the header does not have lines.

goal

I've also wanted to get a more rounded edges from what I have and my line in between isn't where it was supposed to be. I also can't manage to add color to them.

This is what I've achieved up to now:

result

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

Just to explain my code. I need the boxes to be of a delimited size. They can not mutate as the text is typed. I will need to manage each box size individually. Some of them won't have the same width size.

I know my coding is not good. I am a beginner in R and have no experience with LaTeX at all. I think that for one day learning I did a decent job

I've search the forum for a long time looking for vertical semi lines. Please let me know if you can help me.

  • Please use imgur (your images appear to be broken) - meta.stackoverflow.com/questions/300232/ban-imageshack-images – MCMastery Apr 1 '16 at 1:44
  • 1
    Welcome! What's a semi-vertical line? And where is the line in between supposed to be? (And which line?) – cfr Apr 1 '16 at 1:48
  • It seems My images are broken, I've upload at imgur: imgur.com/aLGeN9I. This is what I need. Is a line in the vertical (between columns) that does not get all the area like the one from \begin{tabular}{c|c|c} I need only in some columns. This is what I've got up to now imgur.com/XkBE9Vs – Rodrigo de Alexandre Apr 1 '16 at 1:50
  • It is easier if you use the upload image option in the editor. (Even if you don't yet have enough reputation to embed the image and can only link, it is easier for somebody else to activate the image.) – cfr Apr 1 '16 at 1:55
  • ok I am typing the links on the text one minute. Thanks. this is what I have so far: – Rodrigo de Alexandre Apr 1 '16 at 1:57
2

Warning, I have changed the colours to make the image easier to be recognizable on screen.

enter image description here

My first thought: This is something for tcbraster rather than a table.

However, I provide two solutions, one with a regular table and the second one with tcbraster.

One main issue according to the O.P. are the vertical lines. tcolorbox provides the borderline feature, which can be set individually to any side of the box, with various, TikZ - based styles.

Both use basically special \newtcolorbox boxes for header and normal 'cell' boxes.

It's difficult to fit the vertical spacings in the tabular approach, this is much easier achieved with tcbraster and the raster row skip value. However, \hline does not work there, but this can be faked with a multicolumn raster box, being wrapped in a \fakehline command.

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

A version with 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}
  • This look incredibly smooth and professional! I was mining the tcolorboxes upside-down and I couldn't get anything better than what I had. This approach with tcbraster looks easy to reproduce for this and other tables. I going to start to study right away! I really appreciate @Christian Hupfer! – Rodrigo de Alexandre Apr 1 '16 at 14:59
  • @RodrigodeAlexandre: The tcbraster feature is indeed easier, in my point of view. tcolorbox is kind of a swiss knife ;-) – user31729 Apr 1 '16 at 15:06
  • 1
    @RodrigodeAlexandre: That's the yesterday's bug of the l3kernel needed by \usepackage[most]{tcolorbox} either revert the l3kernel or drop the most option. In this case you can load \usepackage[skins,raster]{tcolorbox} – user31729 Apr 1 '16 at 17:11
  • 1
    @RodrigodeAlexandre: Welcome to the Dark Side of the Force ;-) The bugfree l3kernel will be available soon, I think. – user31729 Apr 1 '16 at 17:50
  • 1
    As a report the your help and gratitude I posting a pick of what I've achieved so far. This is the main carcass for the report. I will add more spaces but most of the needed parts are there. I'm planing to share this with the IT team so they can automatically generate scripts to fill the form with the requested exam,patient and doctor information + admission date and etc. It does look smooth! :) prntscr.com/an3i7j – Rodrigo de Alexandre Apr 2 '16 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.