2

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.

Fred
  • 161
  • You have to compile with latex in dvi mode – Johannes_B Mar 28 '19 at 08:08
  • Are you compiling with PDFLatex ? Because PSTricks does not like it. You might want to look at this answer https://tex.stackexchange.com/a/93767/184389 for a way to compile when using PSTricks. – KersouMan Mar 28 '19 at 08:09
  • Forgot to say : that's already the case (auctex : Command -> TeXing options -> PDF from DVI -> dvips + ps2pdf – Fred Mar 28 '19 at 08:10
  • 1
    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 '19 at 08:16
  • You're right! I added a --output-format dvi in the Latex command line (MikTeX uses luatex by default) and it now compiles. Don't know if it's the cleanest way. Thanks! – Fred Mar 28 '19 at 08:40
  • 1
    You can also compile with xelatex to obtain a pdf. – Ignasi Mar 28 '19 at 10:25
  • 1
    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 '19 at 13:28
  • What would you propose instead ? pdflatex ? – Fred Mar 29 '19 at 22:18

1 Answers1

1

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}

enter image description here

Suggestion

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

Display Name
  • 46,933