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}
5
  • Welcome to TeX SX! What do you try to obtain?
    – Bernard
    Apr 15, 2019 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|}. Apr 15, 2019 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, 2019 at 18:47
  • @Tom I don't think you can do that.
    – Someone
    Apr 16, 2020 at 15:03
  • You would need to do this weird thing, and even then it only works on the rightmost edge.
    – Someone
    Apr 16, 2020 at 15:04

1 Answer 1

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}
2
  • 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, 2019 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. Apr 16, 2019 at 18:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .