# PSTricks at LyX (via pdflatex)

I'm using LyX (at Windows) and I'm trying to get pdf file output while I have PSTricks code (I put as \ERT.
I Try to write at the preamble things like: \usepackage[off]{auto-pst-pdf}  and \usepackage[pdf]{pstricks}, but it still don't compile to pdf file output. (also ps4pdf doesn't help...).

Can you tell me how can I do it?

Thank you!

Here is the code:

 % Preview source code

%% Do not edit unless you really know what you are doing.
\documentclass[twocolumn,english,hebrew]{article}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[T1]{fontenc}
\usepackage[cp1255]{inputenc}
\setlength{\parindent}{0bp}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\def\@outputdblcol{%
\if@firstcolumn
\global \@firstcolumnfalse
\global \setbox\@leftcolumn \box\@outputbox
\else
\global \@firstcolumntrue
\setbox\@outputbox \vbox {%
\hb@xt@\textwidth {%
\kern\textwidth \kern-\columnwidth %**
\hb@xt@\columnwidth {%
\box\@leftcolumn \hss}%
\kern-\textwidth %**
\hfil
{\normalcolor\vrule \@width\columnseprule}%
\hfil
\kern-\textwidth  %**
\hb@xt@\columnwidth {%
\box\@outputbox \hss}%
\kern-\columnwidth \kern\textwidth %**
}%
}%
\@combinedblfloats
\@outputpage
\begingroup
\@dblfloatplacement
\@startdblcolumn
{\@outputpage
\@startdblcolumn}%
\endgroup
\fi
}
\@mparswitchtrue

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{theorem}
\theorembodyfont{\upshape}
\newtheorem{theorem}{\R{משפט}}[section]
\AtBeginDocument{\make@lr\thetheorem}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[crop=off]{auto-pst-pdf}
\usepackage{pstricks}

\makeatother

\usepackage{babel}
\begin{document}
\pscircle(0,0){1}
\end{document}

-

the problem is the missing optional argument -shell-escape for pdflatex. You can add it with Tools->Setup->File->Converter->LaTeX (pdflatex)

Then you need only in the preamble

\usepackage{auto-pst-pdf}
\usepackage{pstricks}


and, of course, but the PSTricks stuff into the pspicture environment:

\begin{pspicture}(-1,-1)(1,1)
\pscircle(0,0){1}
\end{pspicture}


However, using xelatex instead makes it easier, no need for package auto-pst-pdf

-
It's still doesn't work.... –  Yoar Jan 9 '14 at 12:00
maybe that it doesn't save the option. Reconfigure and restart LyX and have a look. If the option is not present, then there is a problem with LyX. Under Linux the option is saved in ~/lyx/lyxrc.default You can edit also this file. –  Herbert Jan 9 '14 at 12:04
ok, then try \usepackage[crop=off]{auto-pst-pdf}. Maybe you have no Perl installed. –  Herbert Jan 9 '14 at 14:48