pdflatex and pstricks - latex

I normally use pdflatex to convert papers written as tex files to a pdf for publishing. With pdflatex any figures in the tex file can be PNG, PDF etc but not PostScript. Now I am writing a paper where I have some figures created with pstricks and that means I have to use latex to generate the a dvi file and then dvips and ps2pdf to obtain the final pdf file.
I cannot generate the pstricks figures separately because they contain citations and references to sections in the paper and if I use the sequence latex->dvips->ps2pdf for the whole tex file I cannot have other figures as PNG or PDF, they have to be converted to PostScript.
Is there an elegant solution to this?

Related

Converting Asciidoc to LaTeX

I want to convert Asciidoc to LaTeX, then use an existing toolchain that includes LaTeX modules to convert the resulting document further to the final format. Asciidoc's native LaTeX conversion is "experimental" according to their documentation, and it also doesn't work for me. There is another toolchain supported by Asciidoc, which is converting to Docbook first, then use dblatex to convert it further. However, it includes a lot of formatting in its LaTeX output, which clashes with the formatting of my toolchain.
Is there any way to convert Asciidoc to LaTex in a way that the content is included in the resulting document, but without any exact formatting rules (expect those explicitly specified in the document). I don't want the LaTeX result to contain any information about fonts, page layout and so on, because for those I already have a toolchain.
I get acceptable, almost good results with this toolchain using pandoc convertor:
edit your document in asciidoc or asciidoctor
convert your document to docbook: asciidoctor -b docbook5 your asciidoc document.
convert your docbook document to (xe)latex using pandoc: pandoc -f docbook your docbook document --pdf-engine=xelatex
You can customize your latex layout and modules in a pandoc configuration file or convert your docbook file into a latex file with pandoc. The converted latex file is quite clean (because its source is docbook).

Converting mathtype equations from word docx to word equations using ruby

I am trying to convert Docx to Html,
but the Docx might contain images, MathType equations in WMF format and word equations in tex format with $ delimiters.
I have tried converting Docx to Html using pandoc and LibreOffice:
Problems using pandoc:
Pandoc skip MathType equations so I had to read document.xml and convert WMF to png using gimp's convert command line tool.
This puts some of the equations in very unreadable format.
Problems using libreoffice:
It actually converts whole documents to HTML very nicely, but word equations get cut from sides during conversion.
What I want is some tool that can convert Docx to Html, and it converts MathType equations as well as word equations both to tex format.
I want to do this preferably in ruby, but any workaround or ideas are most welcome as well.
Thanks.
The pandoc docx reader supports only OMML math, not the old MathType.
You could write a pandoc filter that finds the math in the pandoc AST (it will be there as plain text) and convert them to pandoc math elements which the pandoc LaTeX writer will automatically convert to TeX math.

include figure files in latex [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I am trying to include jpeg files in latex
\includegraphics[width=57.6mm, height=43.2mm]{../../results2/html/zerooneloss_stumps.jpg}
With specified the width and height and compiled with pdflatex, however, it produces the error:
! LaTeX Error: Cannot determine size of graphic in ../../results2/html/zerooneloss_stumps.jpg (no BoundingBox).
The true size of the image is 576x432 in pixels. Have I specified the size correctly in the latex file?
Anyway to use the default setting without need to specify the width and height? If I don't specify the them in the latex file,
\includegraphics[]{../../results2/html/zerooneloss_stumps.jpg}
I still get the same no BoundingBox error.
Thanks and regards!
Change
\includegraphics[]{../../results2/html/zerooneloss_stumps.jpg}
to
\includegraphics{../../results2/html/zerooneloss_stumps.jpg}
still has the no BoundingBox error.
I am using
\usepackage[dvips]{graphicx}
What is the difference between it and
\usepackage{graphicx}
It seems with the former one, eps figure files can work while jpeg files cannot, with the latter, things become reverse?
Is it possiblt to include figure files of both eps and jpg in the same latex file?
Do you have \usepackage{graphicx} in your preamble?
EDIT (consequent of an edit in the question): you should not use the dvips option when using pdflatex. The option produces informations useful for the postprocessing of the dvi output of the latex program (e.g. via dvips). In you case, since you are using pdflatex you should simply not give any option to the graphicx package (the right driver is choosen automatically). On the other hand pdflatex only supports external graphics in PNG, JPG or PDF format, but, as other have said, it's easy to convert EPS to PDF: my preferred way is to use epstopdf that in Ubuntu is provided by the texlive-extra-utils package.
For example, when processed with pdflatex, the following example works if you have a file image.png or image.jpg or image.pdf in the current directory:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{image}
\end{document}
You have to add the package option pdftex to the package graphicx:
\usepackage[pdftex]{graphicx}
try \includegraphics{myfig.jpg}
when you say [width=57.6mm, height=43.2mm] it's the box size in millimeters (mm). latex scales your image to this dimension.
more scale options: http://amath.colorado.edu/documentation/LaTeX/reference/figures.html
For the no Bounding Box error:
What's a BoundingBox?
A BoundingBox is a entry that is located in PostScript files that tells the reader the scale limits of the file. Latex uses this entry to determine how to place the image in the document.
How to fix my Latex problem
It is quite easy to fix this problem. The software package ImageMagick is used in this case to convert the images from one form to another. ImageMagick is able to convert many image formats to many other types. To do the conversion just enter this into your console:
root#Pingu ~ # convert image.jpg image.eps
http://www.tuxpages.com/helppages/latex-convert.shtml

LaTeX font in Postscript document

I am starting off with Postscript, and would like to do something very simple: include a LaTeX symbol within my Postscript document. For example:
%!
/FontSize 12 def
newpath
0 0 moveto
("Hello \LaTeX") show % This is where I would like
% the rendering of \LaTeX
% with actual LaTeX font
showpage
Any ideas?
The \LaTeX logo is just normal letters moved slightly around via kerning. So if you're already hacking raw postscript commands, you should just copy the dimensions from the definition in latex.ltx and issue the same movement commands between the letters in postscript. Ditto to select the CM font, or whatever you would like.
If the aim is to mix together Postscript and Latex in one document, you can use Metapost. Hans Hagen's Metafun manual is the best introduction to Metapost I know of, although note that:
He assumes that you will be using Tex or Context and not Latex. If you want to use Latex macros in Metapost, you will need some additional boilerplate;
Metafun is a slight superset of regular Metapost; and
He more or less ignores the ability of Metapost to embed raw Postscript — the core of the Metapost language is an extension of Knuth's Metafont, and is quite unlike Postscript.
Cf. also Troy Henderson's Embedding fonts in MetaPost output, which explains how to embed Tex fonts in the Postscript files generated by Metapost.

Convert EPS to PDF on the fly with pdflatex on the fly

I'm trying to include an EPS figure in a document that will be compiled using pdflatex. Of course, the picture can be converted to pdf using epstopdf (which comes with the MikTeX distribution). Is there any way to do this on the fly, that is, make pdflatex do the conversion?
I'm looking for such a solution because I want to set up an easy-to-learn environment for students. Ideally, the converted picture is placed in the directory that also contains the original .eps, and the .pdf is used if available.
The relevant answer in the TeX FAQ points to epstopdf.sty, included with Heiko Oberdiek's packages.
I would recommend using latex-mk which is a nice way to have a very simple Makefile for latex construction. Of course you can have eps file converted to pdf, or fig to eps, etc, during the build process.
Currently my Makefile look like that :
NAME=report
TEXSRCS=report.tex
BIBTEXSRCS=biblio.bib
USE_PDFLATEX=true
VIEWPDF=open # cause i'm on osx, gv for most unix
XFIGDIRS=img
## For osx users :
include /opt/local/share/latex-mk/latex.gmk
## For unix users :
#include /usr/share/latex-mk/latex.gmk
When I invoke make, the first thing it does is converting some .fig into .pdf files. I'm pretty sure it would do the same with eps files.
If you want to include one EPS figure in latex then you need to at first make the figure in EPS format if it is not in EPS format.Like if your figure is in .jpeg extension, then you need to make it .eps
Then you need to include it in the LaTex with using some code which is common in LaTex and then to make it in pdf format you need to use one small instruction that is \usepackage{epstopdf}
I was also facing this problem and found this post very helpful "How to Convert .eps to PDF in Latex ?"
Now i am able to include EPS figure in LaTex and also can convert it in PDF. I think you will also get help and all the details from the above link.Let me know if you face any further problem.

Resources