1

I cannot seem to make \hhline draw vertical lines between cells. What am I missing?

\documentclass[a4paper,11pt]{article}
\usepackage{hhline}

\begin{document}
\begin{tabular}{cc}
  A & B \\ \hhline{~|-}
  C & D \\ \hhline{~|-|}
\end{tabular}
\end{document}
  • Welcome to TeX SX! What do you try to obtain? – Bernard Apr 15 at 18:08
  • 1
    Welcome to tex.sx. \hhline is defined to produce only horizontal lines (the "h" in the command). If you want vertical lines separating all the cells, enter the template as {c|c}. If you want them on the outside edges as well, use {|c|c|}. – barbara beeton Apr 15 at 18:11
  • Thanks for the response. Unfortunately, I don't want vertical lines in the template as I don't want vertical lines around all cells, only some. – Tom Apr 16 at 18:47
2

enter image description here

- makes a single line, you need = to get separated double line

\documentclass[a4paper,11pt]{article}
\usepackage{hhline}

\begin{document}
\begin{tabular}{c|c|}
  A & B \\ \hhline{~|=}
  C & D \\ \hhline{~|=|}
\end{tabular}
\end{document}
  • Thanks @DavidCarlisle My PDF does not show the vertical lines regardless of whether I use '-' or '='. Am thinking something specific to my system is wrong. Never had an issue like this. – Tom Apr 16 at 18:52
  • @Tom the vertical lines within the \hhline naturally only show if you have a double line so = rather than -. the vertical lines around the table cells so around B abd D are totally unrelated to \hhline and come from the table preamble, {c|c|} in this case. – David Carlisle Apr 16 at 18:54

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.