# Can't compile mdframed example after miktex installation

I just got a new computer and installed mikTeX, emacs and auctex.

Then I tried to compile a basic example from mdframed documentation :

\documentclass{article}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\usepackage{pstricks}
\usepackage[framemethod=PSTricks]{mdframed}

\begin{document}

Bla!

\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is the dependent
variable, and $f$ is a given non−zero function of the independent
variables alone.
}

\global\mdfdefinestyle{exampledefault}{%
linecolor=red,middlelinewidth=3pt,%
leftmargin=1cm,rightmargin=1cm
}
\begin{mdframed}[style=exampledefault,roundcorner=5]
\ExampleText
\end{mdframed}

\end{document}


I compile using dvips and ps2pdf : In auctex : Command -> TeXing options -> PDF from DVI -> dvips + ps2pdf

I got the same error several times in the log file :

./[activite]-trajectoire.tex:34: Undefined control sequence. \c@lor@to@ps ->\PSTricks _Not_Configured_For_This_Format l.34 \end{mdframed}

I suspect a configuration problem related with mikTeX but didn't find anything.

• You have to compile with latex in dvi mode – Johannes_B Mar 28 at 8:08
• Are you compiling with PDFLatex ? Because PSTricks does not like it. You might want to look at this answer tex.stackexchange.com/a/93767/184389 for a way to compile when using PSTricks. – KersouMan Mar 28 at 8:09
• The error clearly says that you are using pdflatex instead of latex, so check the configuration. Btw: the hyphen in non−zero is not a hyphen but U+2212 and gives an error too. – Ulrike Fischer Mar 28 at 8:16
• You can also compile with xelatex to obtain a pdf. – Ignasi Mar 28 at 10:25
• luatex and dvi mode isn't the best choice - you will get problems with the fonts and dvips can't handle them. – Ulrike Fischer Mar 28 at 13:28

You have to use either xelatex or latex followed by dvips followed by ps2pdf.

\documentclass{article}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\usepackage{pstricks}
\usepackage[framemethod=PSTricks]{mdframed}

\begin{document}

Bla!

\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\newrobustcmd\ExampleText{%
An \textit{inhomogeneous linear} differential equation has the form
\begin{align}
L[v ] = f,
\end{align}
where $L$ is a linear differential operator, $v$ is the dependent
variable, and $f$ is a given non−zero function of the independent
variables alone.
}

\global\mdfdefinestyle{exampledefault}{%
linecolor=red,middlelinewidth=3pt,%
leftmargin=1cm,rightmargin=1cm
}
\begin{mdframed}[style=exampledefault,roundcorner=5]
\ExampleText
\end{mdframed}

\end{document}


# Suggestion

Using tcolorbox package might be better because it has more features with relatively excellent documentation.