skip to Main Content

I have the following LaTex file:

documentclass[tikz]{standalone}
begin{document}
begin{tikzpicture}
node[fill=yellow]{Hello World!};
end{tikzpicture}
end{document}

and I would like to get a single png file from that file. How can I do that?

Many thanks!

PD: I use Ubuntu 22.04

I tried the command convert, online converting but I need something snappy.

2

Answers


  1. Chosen as BEST ANSWER

    Use the following command in your shell prompt:

    $ pdflatex example.tex && pdftocairo -png example.pdf -r 300 -singlefile
    

    This will, of course, produce as well a pdf file.

    enter image description here


  2. If you have imagemagick installed and compile your document with shell-escape enabled, you can simply use the convert option of the standalone class:

    documentclass[tikz,convert]{standalone}
    begin{document}
    begin{tikzpicture}
    node[fill=yellow]{Hello World!};
    end{tikzpicture}
    end{document}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search