last day (15 days later) » 

5:08 PM
0
A: How to convert pdf file to image in latex file

MarijnThe example in the question has two documentclass commands, which is not allowed in LaTeX. You can use a single command with the convert option added to the options of the first line. Note that the second 2pt option does not do anything, it generates a warning and it can be removed. Note also th...

 
@ Marijn, I run it and only a text file is created, not png file
Text file is for pdf file. So there is no image file created, probably because it can not find convert.
I run it in TexStudio, and so I don't know the error
 
@MathWizard in TeXstudio errors are shown in the bottom of the screen, see sourceforge.net/p/texstudio/bugs/1466/attachment/….
 
@Marijn, there is no error in TexStudio. It says "Process exited normally", but no image created.
 
@MathWizard could you check the log file? It probably contains some more information.
 
I can not find log file either
 
5:08 PM
@MathWizard the log file is created in the same folder as the pdf. It has the same name as the .tex and .pdf files but then with a .log extension (e.g., in my example above the source is called convpng.tex, the pdf is called convpng.pdf and the log file is called convpng.log). You can open the log file in any text editor, for example Notepad in Windows. It should have some lines containing the word runsystem and convert. If there are errors they will be reported around those lines.
 
No, I can not find log file in TexStudio. The log file is created by TexWork, different software.
I think TexStudio creates a text file which is actually log file. But it is pretty long. How do I post it?
 
Let's talk here
are you using TeXstudio or TeXworks? They are different programs that do the same thing
i.e., they are both editors that call the LaTeX compiler in the background
 
I can not upload text file
 
that is no problem, if necessary you can copy-paste things here
In any case, did you try my example code? It's short, so the log is also not very long and relatively easy to understand
 
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex 2018.1.29) 12 MAR 2018 13:05
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**./QuasiInfinitonDiagram.tex
(./QuasiInfinitonDiagram.tex
LaTeX2e <2017-04-15>
Babel <3.17> and hyphenation patterns for 84 language(s) loaded.
(c:/texlive/2017/texmf-dist/tex/latex/standalone/standalone.cls
Document Class: standalone 2015/07/15 v1.2 Class to compile TeX sub-files stand
alone
(c:/texlive/2017/texmf-dist/tex/generic/oberdiek/ifluatex.sty
 
5:13 PM
that is the log file for sure, you found it :)
it's not the short example I put in my answer but let's see if we can find something
it says (line 80 and a bit above): Class standalone Warning: Conversion failed! Please ensure that shell escape (standalone) is enabled (e.g. use '-shell-escape').
so that could be the problem
did you enable shell escape?
 
How to enable shell escape?
 
that depends a bit on the editor
but, as I explained in my answer, if you put at the top of your file the line % !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape] then it might work
if that doesn't work there are some other solutions
with the %, so the first line of your file should be:
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
 
It gives message:
'imgconvert' is not recognized as an internal or external command, operable program or batch file.
 
that is an improvement :)
 
5:29 PM
Ok. Thanks. I will do it separately
 
no need, this can work :)
try \documentclass[preview,border=2pt,convert={convertexe={convert.exe},density=300,‌​outext=.png}]{standalone}
of course you need to have imagemagick installed, but I assume that you have that
 
It hangs
I already install imagemagick and it is working from command line
 
it hangs, really? no error messages?
 
no, it hangs after invoke imgconvert
Thanks anyway. I can do it separately
 
5:45 PM
ok
 

last day (15 days later) »