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) - http://meta.stackoverflow.com/questions/300232/ban-imageshack-images – MCMastery Apr 01 '16 at 01:44
  • 1
    Welcome! What's a semi-vertical line? And where is the line in between supposed to be? (And which line?) – cfr Apr 01 '16 at 01:48
  • It seems My images are broken, I've upload at imgur: http://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 http://imgur.com/XkBE9Vs – Rodrigo de Alexandre Apr 01 '16 at 01: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 01 '16 at 01:55
  • ok I am typing the links on the text one minute. Thanks. this is what I have so far: – Rodrigo de Alexandre Apr 01 '16 at 01:57
  • You don't really need boxes for most of the table - only the tabs, it seems to me. Rather oddly, booktabs would probably actually give you the semi-vertical lines you want. (Usually, people consider lines like this a problem to be solved.) booktabs doesn't work with vertical lines because, basically, they end up 'gappy'. But if gappy is your thing, then it might work OK. – cfr Apr 01 '16 at 01:58
  • Or do it all with tcolorboxes, of course. But that seems like more work. – cfr Apr 01 '16 at 02:00
  • I'm learning \tcoloredboxes my Knowledge is a little limited. I will try the book approach it seems easier to handle this is the report so far that the link is broken http://imgur.com/Z58TDV7 And thanks Feldman – Rodrigo de Alexandre Apr 01 '16 at 02:03
  • Don't say sharp corners if you want rounded ones. – cfr Apr 01 '16 at 02:04
  • @cfr, thanks for your help. I've tried to remove sharp corners however it also removes the rounded corners=north. I want a more rounded curve at the top and still keep the straight line in the bottom... Is there a way I can increase the arc? without having to create an object? – Rodrigo de Alexandre Apr 01 '16 at 02:14
  • You can say e.g. arc=9mm or whatever. At least, that's what I've used for a single rounded corner. – cfr Apr 01 '16 at 02:47

1 Answers1

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 01 '16 at 14:59
  • @RodrigodeAlexandre: The tcbraster feature is indeed easier, in my point of view. tcolorbox is kind of a swiss knife ;-) –  Apr 01 '16 at 15:06
  • Hi @Christian,sorry for asking more info. I just had time to sit and play with the code. I'm new to LaTeX and I'm experiencing some issues with \usepackage[most]{tcolorbox} This most argument is generating an issue regarding the package version http://prntscr.com/amuvuk. I've open MiKTeX and re-installed the tcolorbox and I still get the same message. http://prntscr.com/amuusd This is the output I'm getting without the updated package: http://prntscr.com/amuv2b. Could you assist me with a link or a guide of why I'm getting this error?I'm using RStudio to write LaTeX under MiKTeX 2.9.5840 – Rodrigo de Alexandre Apr 01 '16 at 17:00
  • 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} –  Apr 01 '16 at 17:11
  • Perfect! I just reverted l3kernel and installed again and it worked like a charm! Thanks a lot! Now I will start to play with it :D – Rodrigo de Alexandre Apr 01 '16 at 17:49
  • 1
    @RodrigodeAlexandre: Welcome to the Dark Side of the Force ;-) The bugfree l3kernel will be available soon, I think. –  Apr 01 '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! :) http://prntscr.com/an3i7j – Rodrigo de Alexandre Apr 02 '16 at 06:23
  • @RodrigodeAlexandre: That looks really awesome! Congratulations to your achievements! –  Apr 02 '16 at 08:33