"Error Producing PDF" when markdown contains a horizontal rule: --- or ***

When my Markdown file contains a horizontal rule --- or *** I receive an error regarding \Linethickness -> \Protect

I understand there have been issues with MiKTeX recently, however I am unsure whether they apply here.

I have been experiencing this issue since yesterday morning, when I was playing around trying to get the Lato font package to work with a set of Markdown files I need to convert to PDF. It had been working fine (asides from the font issue).

This could have happened when I updated MiKTeX, although at the time I hadn't realised that could be the case, as I was also playing with the templates, YAML, PS Script etc.

Since then I've been reading about the MiKTeX issue and I've tried further updates, updating package database, building formats, refreshing file name database and uninstalling and reinstalling. I have read the background in the comments section on GitHub but the suggestions there do not seem to have solved it for me, whereas they have for others.

This makes me question whether this is related, but I am relatively new to Tex, Markdown etc.

The original file was longer and more complex, but this Markdown

# Sample File
Test Test Test


Produces the same error

Error producing PDF.
! Missing number, treated as zero.
<to be read again>
\linethickness ->\protect
\setlength #1#2->#1 #2
\@rule [email protected] {#2}\setlength \@tempdimc {#3}
                                                  \advance \@tempdimc \@temp...
l.362 ...nter}\rule{0.5\linewidth}{\linethickness}

Removing the --- allows the pdf to generate in both the above example and my more complex markdown file, even with templates.

I am unsure if linethickness is within the graphics package, when I look at package information I can't see anything that obviously indicates it is.

I would simply remove the offending lines but they are used throughout the remainder of the markdown files and I would prefer to find a fix, with your help, if possible! Please could you let me know if I'm barking up the wrong tree with this recent MiKTeX issue or not, and if not, where I might be going wrong. Many Thanks in advance.

Update: I ran this command

pandoc -s sample.md -o sample.tex

to produce this tex:

% Options for packages loaded elsewhere
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{microtype.sty}{% use microtype if available
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
\@ifundefined{KOMAClassName}{% if non-KOMA class
  }{% else
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
  pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\setlength{\emergencystretch}{3em} % prevent overfull lines
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering




\section{Sample File}\label{sample-file}}

Test Test Test




meanwhile, I tried this (as root in a latest RStudio Debian install):

~# sed 's,\\linethickness,0.5000000000pt,g' < pandoc/pandoc > /usr/lib/rstudio-server/bin/pandoc/pandoc

where the 1st pandoc/pandoc is a copy of the original from package. That keeps the same string length and valid number so that the binary won't break. That writes the hrule as:


and MiKTeX seems fine with it (at least TeXworks compiles the pdf).

HTH bye

Posted on by Anonymous