# Run msc package with pdflatex instead of xelatex

I am using msc Latex package for building sequence diagrams, but I can only run it with Xelatex, which I don't like, but apparently it's possible I can use pdflatex if I run it with:

pdflatex -shell-escape <file> option.

But I am using Vim-Latex, and where do I specify this option? I cannot figure this out.

This is my vimrc:

let g:Tex_DefaultTargetFormat='pdf'
function CompileXeTex()
let oldCompileRule=g:Tex_CompileRule_pdf
let g:Tex_CompileRule_pdf = 'xelatex -aux-directory=F:/Vim/my_latex_doc/temp --synctex=-1 -src-specials -interaction=nonstopmode $*' call Tex_RunLaTeX() let g:Tex_CompileRule_pdf=oldCompileRule endfunction  P.s. This says that with newest msc version all PSTricks dependancies are removed but I downloaded that version, put it instead of old one, but I still get such errors when running with pdflatex: error| Undefined control sequence. \c@lor@to@ps  So I guess it still depends on PSTricks. Or unless it's not enough to change msc.sty? I just changed the contents of the file to new version. So my goal is to run this with Pdflatex instead of Xelatex. My code: \documentclass[a4paper,11pt]{article} \usepackage[T1]{fontenc} %\usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{eurosym} \usepackage{wasysym} \usepackage{todonotes} \usepackage{geometry} \usepackage{enumitem} \usepackage{ulem} \usepackage{msc} \usepackage[pdf]{pstricks} \title{aaa} \author{aaaaa} \begin{document} \normalsize \maketitle \tableofcontents \newpage \section{In} \section{aa} \subsection{} \begin{center} \begin{msc}{Deactivate cc} \setlength{\instdist}{9cm} \setlength{\envinstdist}{2\envinstdist} \declinst{cc}{}{C} \declinst{tt}{}{T} \nextlevel \mess{NonceC}{cc}{tt} \nextlevel[2] \mess{\{$pu_C$,$[byebye]_{pr_C}\}_{pu_T}$}{cc}{tt} \end{msc} \end{center} \end{document}  EDIT: I added: let g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode -shell-escape$*'


to my vimrc as suggested, but I still get PSTricks error:

error| Option clash for package pstricks.

• You should try to load auto-pst-pdf  and compile with the -shell-escape switch if your system is TeX Live, or --enable-write18 if it's MiKTeX. This will allow compiling with d Dec 8, 2014 at 19:50
• I know that, but that's my question - how do I do it? I use vim, and where do I put that -shell-escape in my vimrc? Dec 8, 2014 at 19:58
• please always provide an example document that demonstrates the error. the error you show is unrelated to pstricks it is from the color package, usually if you give it a [dvips] option when you are using pdflatex rather than latex+dvips Dec 8, 2014 at 20:09
• I'm sorry, I don't know vim. Having checked on the web, maybe this compilation rule: g:Tex_CompileRule_pdf = 'pdflatex --interaction=nonstopmode --shell-escape $*'. Dec 8, 2014 at 20:16 • @Bernard Thanks, but it says Pattern not found: Tex_CompileRule_pdf = 'pdflatex --shell-escape$*'. @David I added code. Dec 8, 2014 at 20:25

Use it this way: packages which uses PSTricks should not be loaded when running pdflatex and, of course, tikz and todonotes should not be loaded when running latex. My example use the postscript environment:

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{eurosym}
\usepackage{wasysym}
\usepackage{geometry}
\usepackage{enumitem}
\usepackage{ulem}
\usepackage{auto-pst-pdf}
\ifpdf
\usepackage{todonotes}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\else
\usepackage{msc}
\fi
\title{aaa}
\author{aaaaa}

\begin{document}
\maketitle
\tableofcontents
\newpage
\section{In}

\section{aa}
\subsection{b}

\begin{center}
\begin{postscript}
\begin{msc}{Deactivate cc}
\setlength{\instdist}{5cm}
\setlength{\envinstdist}{2\envinstdist}
\declinst{cc}{}{C}
\declinst{tt}{}{T}
\nextlevel
\mess{NonceC}{cc}{tt}
\nextlevel[2]
\mess{\{$pu_C$, $[byebye]_{pr_C}\}_{pu_T}$}{cc}{tt}
\end{msc}
\end{postscript}
\end{center}

\subsection{e}

\begin{center}
\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=4cm]
\node[initial,state,accepting] (deact)      {$D$};
\node[state]         (init) [right of=deact]  {$d$};

\path[->] (deact) edge              node {issue} (init)
(init) edge [bend left]  node {block} (deact);
\end{tikzpicture}
\end{center}

\end{document}


• Oh this is just great, works perfectly! I am just wondering, what's that postscript environment, cause I couln't find anything in google about it, would be nice to understand how it works. Dec 8, 2014 at 21:52
• run texdoc pst-pdf for more explanations
– user2478
Dec 8, 2014 at 21:56

Or you can just use the development version of msc.sty found here, (linked from the very bottom of the official website, here), bung that file in the directory you're compiling from, and it will compile straight to PDF no problem.