# Remove \midrule in table

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:
\newlength{\toprulewidth}
\setlength{\toprulewidth}{0.ex}
\patchcmd{\toprule}% <cmd>
{\heavyrulewidth}{\toprulewidth}% <search><replace>
{}{}% <success><failure>

\newlength{\bottomrulewidth}
\setlength{\bottomrulewidth}{0.ex}
\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:

\newlength{\midrulewidth}
\setlength{\midrulewidth}{0.ex}
\patchcmd{\midrule}% <cmd>
{\heavyrulewidth}{\midrulewidth}% <search><replace>
{}{}% <success><failure>


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

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

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

\def\toprule{}
\def\bottomrule{}
\def\midrule{}


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

\renewcommand*{\toprule}[1][]{}
\renewcommand*{\bottomrule}[1][]{}
\renewcommand*{\midrule}[1][]{}


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