0

How can I make a similar table as the below image with a sidebar pointing to some rows is the table? enter image description here

My attempt to create something similar

\documentclass[12pt]{article}
\usepackage{color, colortbl}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning, fit, shapes.misc}

\usetikzlibrary{decorations.pathreplacing, calc}

\begin{document}
\begin{table}[!ht]
\caption{HMM}\label{tab1}
\centering
\scriptsize
\begin{tabular}{|c|c|c|}
\hline\\[-1.5ex]
blablablabla & blablablabla & blablablabla \\[0.5ex]
\hline\\[-1.5ex]
blabla& blabla & blabla\tikzmark{a}\\[0.5ex]
\hline
blabla& blabla & blabla \\[0.5ex]
\hline
blabla& blabla & blabla \\[0.5ex]
\hline
blabla& blabla & blabla \tikzmark{b}\\[0.5ex]
\hline
\end{tabular}
\begin{tikzpicture}[remember picture, overlay]
\draw[very thick] ($(pic cs:a) + (2.5em,0)$) -| ($(pic cs:a) + (4.5em,0)$) -- ($(pic cs:b) + (5em,0)$) -- ($(pic cs:b) + (3em,0)$) --($(pic cs:a) + (2.5em,0)$); 
\end{tikzpicture}
\end{table}

\end{document}
Dalek
  • 509
  • 1
    Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.

    • Note this is a Q&A site, not a please do this for me service. What do you have so far.

    – albert Aug 16 '19 at 14:51
  • Probably you can get an idea from here: https://tex.stackexchange.com/a/187006/134144 and here: https://tex.stackexchange.com/a/182693/134144 – leandriis Aug 16 '19 at 15:39
  • @albert I added my code which is not at all what I want. – Dalek Aug 16 '19 at 17:04
  • @leandriis I made an example code using the links you provided but it is not like the table I would like to make especially I would like to be able to write in the box in the right hand side of the table. – Dalek Aug 16 '19 at 17:11

1 Answers1

3

With the modified tikzmark command from Ignasi's answer you can get the following that might serve as a point to start from:

enter image description here

\documentclass[12pt]{article}

\usepackage{multirow}

%%%%% modified tikzmark command from here: https://tex.stackexchange.com/a/182693/134144
\usepackage{tikz}
\usetikzlibrary{matrix}
\newcommand{\tikzmark}[2]{\tikz[overlay, remember picture] \node[inner sep=0pt, outer sep=0pt, anchor=base] (#1) {#2};}
%%%%%%%%%%

\begin{document}
\begin{table}[!ht]
\caption{HMM}\label{tab1}
\centering
\begin{tabular}{|c|c|c|@{}p{1cm}@{}|c|}
\cline{1-3} \cline{5-5}
blablablabla & blablablabla & blablablabla & & \parbox[t]{3mm}{\multirow{7}{*}{\rotatebox[origin=c]{90}{rotated text}}}\\
\cline{1-3}
blabla& blabla & blabla &\tikzmark{a}{} &\\
\cline{1-3}
blabla& blabla & blabla & &\\
\cline{1-3}
blabla& blabla & blabla & &\\
\cline{1-3}
blabla& blabla & blabla & \tikzmark{b}{} &\\
\cline{1-3}
blabla& blabla & blabla & &\\
\cline{1-3}
blabla& blabla & blabla & &\\
\cline{1-3} \cline{5-5}
\end{tabular}
\tikz[overlay,remember picture] {
  \draw[<->] (a) -- ++(0:1cm);
  \draw[<->] (b) -- ++(0:1cm);
}
\end{table}

\end{document}
leandriis
  • 62,593
  • one small question: how can I make this horizontal half lines between rows in my table? – Dalek Aug 16 '19 at 18:38
  • @Dalek: You can use the arydshln package that includes the \hdashline and \cdashline commands as equivalents to \hline cna \cline. – leandriis Aug 16 '19 at 20:50