I am writing a paper in markdown and using pandoc and a latex template to render a pdf. I have tables, and I need there to be no lines. I found on the web how to remove the top and bottom lines of the table using:

\usepackage{etoolbox} %% For patchcmd
%% Remove top and bottom horizontal lines from tables:
\patchcmd{\toprule}% <cmd>
  {\heavyrulewidth}{\toprulewidth}% <search><replace>
  {}{}% <success><failure>

\patchcmd{\bottomrule}% <cmd>
  {\heavyrulewidth}{\bottomrulewidth}% <search><replace>
  {}{}% <success><failure>

This works great, but when I create certain multi-line tables, a horizontal line is also added above the first line (below the heading text). I looked at pandoc's tex output, and I see \midrule, which I interpret to be how the line is getting drawn. So I tried to adapt the code above to midrule:

\patchcmd{\midrule}% <cmd>
  {\heavyrulewidth}{\midrulewidth}% <search><replace>
  {}{}% <success><failure>

But this doesn't work. How can I remove this line from my tables?

  • 1
    \def\midrule{} ? Jul 31, 2017 at 15:51
  • The length parameter you're looking for is called \lightrulewidth, not \midrulewidth.
    – Mico
    Jul 31, 2017 at 16:34

2 Answers 2


The code you're showing appears to be unnecessarily complicated. If all you need to do is disable \toprule, \bottomrule, and \midrule, you should write


in the preamble.


\toprule, \bottomrule, and \midrule each have an optional argument to set the the rule width. If you are sure, they are not used, then Micos answer is the way to go. If not, you should redefine them as


to also get rid of the optional argument. Otherwise you may find something like "[1pt]" in the PDF file.

You must log in to answer this question.

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