# Create horizontal line in table cell in latex [pics]

So basically i was wondering how id go about getting the table below to have a line across from the control column to the justification column for each 'newline' within the pre-existing row.

Extra brownie points if it works for longtable and is simple!

\setlength\LTleft{-2cm}
\setlength\LTright{-2cm}
\begin{tabular}
{ | p{1cm} | p{2cm} | p{1cm} | p{4cm} | p{0.5cm} | p{1cm} | p{1cm} | p{1.5cm} | p{1.5cm} | }
\hline
Risk Tag & Risk & Risk Severity & Control & Cost & Benefit & Chosen & Residual Risk & Justification \\
\hline
R01 & Eavesdropping on local network & Critical & Prevent C1 - Patch wireless router - if patch available \newline  Prevent C2 - Use https everywhere browser plugin where available & L & H & Y & L & Free and Effective\\
\hline
R02 & MITM on local network & High\\
\hline
R03 & Infection of Phones via Exploit & High \\
\hline
\hline
\end{tabular}


heres the image, i want the line in between the two prevents if possible

• \cline{4-5} ? – Zarko Nov 25 '17 at 23:30
• ya bro that doesn't work unfortunately :( – dipl0 Nov 25 '17 at 23:35
• what means "doent work"? you should clarify your question, maybe add a sketch, what you like to achieve. but in the first, extend your code snippet to complete small document, beginning with \documentclass{...} and ending with \end{document}. help us to help you. – Zarko Nov 25 '17 at 23:44
• hey zarko, you seem a little salty, maybe consider leaving your house – dipl0 Nov 26 '17 at 0:33

If you place the second "prevent" in a separate row, you can use \cline as suggested in a comment. You might need \multirow for the "Eavesdropping" cell though.

\documentclass{article}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{geometry}
\geometry{margin=1cm}
\begin{document}
{\small
\begin{longtable}
{ | p{1cm} | p{2cm} | p{1cm} | p{4cm} | p{0.5cm} | p{1cm} | p{1cm} | p{1.5cm} | p{1.5cm} | }
\hline
Risk Tag & Risk & Risk Severity & Control & Cost & Benefit & Chosen & Residual Risk & Justification \\
\hline
R01 & \multirow{2}{*}{\parbox[t]{2cm}{Eavesdropping on local network}} & Critical & Prevent C1 -- Patch wireless router -- if patch available & L & H & Y & L & Free and Effective\\ \cline{4-9}
&  & & Prevent C2 - Use https everywhere browser plugin where available &&&&& \\
\hline
R02 & MITM on local network & High\\
\hline
R03 & Infection of Phones via Exploit & High \\
\hline
\hline
\end{longtable}}
\end{document}

• incredible, nice ! – dipl0 Nov 26 '17 at 0:13
• @dipl0, please tell me now, what not work considering my comment? – Zarko Nov 26 '17 at 0:18
• @Zarko The two "prevent" sentences were in the same cell. – Torbjørn T. Nov 26 '17 at 0:19
• @TorbjørnT., i suspect this ... anyway, OP's table has other issues too. it is to wide to be fit in text width, i would consider booktabs and remove vertical lines, etc :-) however for me is now time for go to sleep ... – Zarko Nov 26 '17 at 0:24
• hey zarko! ya seem a bit sarko! – dipl0 Nov 26 '17 at 0:27