Conversion ToolsProblem with conversion from PS to PDF

Information and discussion about output converters related to LaTeX (e.g. dvips, ps2pdf, ...)
User avatar
lanmmt
Posts: 21
Joined: Tue Sep 28, 2010 6:43 pm

Problem with conversion from PS to PDF

Post by lanmmt »

Well I was playing around with ps2pdf and I'm also unhappy with the results - what is making me unhappy is when I'm selecting some text, it selects text strangely ... I attached an example that shows the problem.

The problem might be related to that described in »Converting from PS to PDF«.
Attachments
ps2pdfTEST.pdf
(13.29 KiB) Downloaded 452 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Problem with conversion from PS to PDF

Post by localghost »

lanmmt wrote:Well I was playing around with ps2pdf and I'm also unhappy with the results - what is making me unhappy is when I'm selecting some text, it selects text strangely ... I attached an example that shows the problem.
The entire code of that sample would be much more interesting to see what might cause this behaviour.


Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
User avatar
lanmmt
Posts: 21
Joined: Tue Sep 28, 2010 6:43 pm

Problem with conversion from PS to PDF

Post by lanmmt »

Code: Select all

\documentclass[11pt]{book}
%\usepackage[left=2.8cm, right=2.8cm, bottom=4cm]{geometry}

%%%%%%%%%%% FONTS %%%%%%%%%%
%\usepackage{english}
\usepackage{tipa}
\usepackage[T1]{fontenc}
\usepackage{anyfontsize}


%%%%%%%%%% FONTS MATH %%%%%%%
%\usepackage{pxfonts}
%\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
%\usepackage{dsfont}

\usepackage{braket}

\usepackage{enumerate}


\usepackage[usenames,dvipsnames]{pstricks}
% \usepackage{epsfig}
% \usepackage{pst-grad} % For gradients
% \usepackage{pst-plot} % For axes
\usepackage{graphicx}
\usepackage{picture}
\usepackage{epsfig}
\usepackage{psfrag}
\usepackage{color}
\usepackage{subfigure}

%%%%% MY DEF. %%%%
\newtheorem{proof}{Proof}[section]% ew. zmienić num.

 %%% cz I %%%
\newcommand{\dd}{\mathrm{d}} % pochodna - d
\newcommand{\db}{\mathrm{dB}}

\newcommand{\e}{\mathrm{e}} % liczba e
\newcommand{\ii}{\mathtt{i}} % liczba i
 %%% cz II %%%
\newcommand{\w}{\boldsymbol} % pogrubienie na wektor
\newcommand{\E}{\mathcal{E}} % enargia - E "kręcone"

 %%% cz przed I %%%
\newcommand{\h}{\hat} % do macierzy
\newcommand{\lf}{\left}
\newcommand{\ri}{\right}
%\usepackage{textcomp}
\newtheorem{EX}{Example}[subsection]

\newcommand{\Tr}{\mathrm{Tr}} % ślad macierzy Tr
\newcommand{\kb}{k_B} % 
\newcommand{\kbt}{k_B T}
\newcommand{\kbT}{k_B T}

\newcommand{\tx}{\text}
\newcommand{\vel}{\upsilon}


%%%%%%% GRAPHIC & TABLES %%%%%%%%%%%%%%
\usepackage{epsfig}
%\usepackage{floatflt}
\usepackage{wrapfig}
\usepackage{multirow}


\usepackage{braket} % pakiet do "nawiasów"






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% New definition of square root:
% it renames \sqrt as \oldsqrt
\let\oldsqrt\sqrt
% it defines the new \sqrt in terms of the old one
\def\sqrt{\mathpalette\DHLhksqrt}
\def\DHLhksqrt#1#2{%
\setbox0=\hbox{$#1\oldsqrt{#2\,}$}\dimen0=\ht0
\advance\dimen0-0.2\ht0
\setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
{\box0\lower0.4pt\box2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\allowdisplaybreaks[4] %łamanie wierszy z wyrażeniami mat.

\begin{document}
are separate and their particles do not mix, that is particle number $N$ and $N_0$ and volumes of the systems are constant, they can exchange the energy.
%%%%%%%%%% rysunek %%%%%%%%%%%%%
\begin{center}
\scalebox{1} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-1.65)(6.54,1.65)
\psellipse[linewidth=0.04,dimen=outer,fillstyle=solid](3.85,0.0)(2.69,1.65)
\psellipse[linewidth=0.04,dimen=inner,fillstyle=solid](1.59,0.43)(1.59,0.96)
\usefont{T1}{ptm}{m}{n}
\rput(1.5214063,0.48){$E$, $N$, $V$}
\usefont{T1}{ptm}{m}{n}
\rput(3.8914063,-0.72){$E_0-E$, $N_0$, $V_0$}
\usefont{T1}{ptm}{m}{n}
\rput(4.4178123,0.52){heat bath}
\end{pspicture} 
}
\end{center}
\end{document}
so here it is
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Problem with conversion from PS to PDF

Post by localghost »

Uh-oh, what a dump of code. Never thought that it would be so much. At first sight I see some obsolete packages [1]. Furthermore you are loading packages twice.

Many packages and other parts of the code seem not to be relevant to the problem. But I assume that you need them and know exactly what they are doing.

Since it is too time consuming to dig through the code of your example, I can only offer a short document that should work fine.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{pstricks-add}

\begin{document}
  are separate and their particles do not mix, that is particle number $N$ and $N_0$ and volumes of the systems are constant, they can exchange the energy.

  \begin{figure}[!ht]
    \centering
    \begin{pspicture}[showgrid=false](-3,-2)(3,2)
      \psellipse(0,0)(2.5,1.5)
      \psellipse[fillstyle=solid](-1.5,0.75)(1.5,0.9)
      \rput(-1.5,0.75){$E$, $N$, $V$}
      \rput(0,-0.75){$E_0-E$, $N_0$, $V_0$}
      \rput(1,0){heat bath}
    \end{pspicture}
    \caption{A figure}\label{fig:figure}
  \end{figure}
\end{document}
Compile this the way you mentioned and see if it is working. Otherwise present a minimal example that reproduces the behaviour [2]. That means to shorten the original code until a minimum remains that fails.

[1] View topic: Obsolete packages and document classes — Avoid usage!
[2] View topic: Avoidable mistakes
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Problem with conversion from PS to PDF

Post by CrazyHorse »

lanmmt wrote: so here it is
it is a problem with the viewer and not the code and not ps2pdf.

Herbert
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Problem with conversion from PS to PDF

Post by localghost »

CrazyHorse wrote:it is a problem with the viewer and not the code and not ps2pdf. […]
I can comprehend the problem with Adobe Reader (on Wind0ws) and Okular (on Linux). Tests on my other machine with other viewers on Wind0ws will have to wait until I fixed the hardware crash.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
User avatar
lanmmt
Posts: 21
Joined: Tue Sep 28, 2010 6:43 pm

Problem with conversion from PS to PDF

Post by lanmmt »

...well it works, almost...
now the text is ok, but all the time I see that (1,1) in the left top corner, and in the book (I'm writing - that's the cause of so long preambule - I need it all, and thank you that you have noticed I have double comends) I get two extra pages at the begining o_O and I get this:

Code: Select all

! Undefined control sequence.
\resetOptions ...\pst@linetype {0}\pstScalePoints 
                                                  (1,1){}{}\psset [pstricks-...
l.2054 \resetOptions
                    
? h
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

? 

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.2054 \resetOptions
                    
? 
)
the same problem was with the code you've posted.
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Problem with conversion from PS to PDF

Post by CrazyHorse »

lanmmt wrote:...well it works, almost...
now the text is ok, but all the time I see that (1,1) in the left top corner, and in the book (I'm writing - that's the cause of so long preambule - I need it all, and thank you that you have noticed I have double comends) I get two extra pages at the begining o_O and I get this:

Code: Select all

! Undefined control sequence.
\resetOptions ...\pst@linetype {0}\pstScalePoints 
                                                  (1,1){}{}\psset [pstricks-...
l.2054 \resetOptions
the same problem was with the code you've posted.
your PSTricks files are really out of date, update your system.

Herbert
User avatar
lanmmt
Posts: 21
Joined: Tue Sep 28, 2010 6:43 pm

Problem with conversion from PS to PDF

Post by lanmmt »

Ok, I think I've solved my last problem, I've searched the files pstricks is using I've started with the pst-math - which is last named in the log, and than I had an idea, maybe it's something with the

Code: Select all

\usepackage{pstricks-add}
which (I've forgot to say earlier) solved the earlier problem. So I've looked for something that might be 'bad' and than went to 2035 line and commented it. And tadam it's working:D

So summarising:
I've
1) added

Code: Select all

\usepackage{pstricks-add}
2) removed

Code: Select all

\usepackage[usenames,dvipsnames]{pstricks}
(optional)
3) commented line 2035 in pstricks-add.tex (I've fonded it in C:\Program Files (x86)\MiKTeX 2.7\tex\generic\pstricks-add):

Code: Select all

 %\pstScalePoints(1,1){}{}%
4) made compilation ps2pdf (actualy I've written a code:

Code: Select all

@rem You can put here any commands you want - this batch file can be executed from LEd's toolbar
@rem There are 3 parameters passed  to this batch:
@rem     %1 - <MAINFILEDIR>
@rem     %2 - <MAINFILENAME>
@rem     %3 - <MAINFILEDISK>
@rem You can also define in tex_cmd.gd file some additional parameters to be passed to this batch file.
@echo off
%3
cd %1
latex.exe --src-specials %2
dvips.exe %2.dvi -o %2.ps
ps2pdf.exe %2.ps %2.pdf
so I have a dvi, ps and pdf document;)
User avatar
lanmmt
Posts: 21
Joined: Tue Sep 28, 2010 6:43 pm

Problem with conversion from PS to PDF

Post by lanmmt »

CrazyHorse wrote: your PSTricks files are really out of date, update your system.

Herbert
well I thought I've updated them last night, maybe my MikTeX haven't noticed something. I'll try to update them once more, if that won't help, maybe I should try to update them manualy?
Post Reply