TransWikia.com

Tikz figure doesn't display using the pdflatex command

TeX - LaTeX Asked by Thierry Templier on July 3, 2021

I’m trying to create an image file from Tikz content using the pdflatex command.

Here is the Tikz content:

begin{document}

usepackage{tikz}
usetikzlibrary{automata, positioning, arrows, shapes}

tikzset{
  box/.style    = {draw, rectangle, minimum height = 2.5em, minimum width = 2.5em},
  circl/.style  = {draw, circle, minimum size = 8mm,label={[font=small, inner sep=1pt]200:$+$}},
  input/.style  = {coordinate},
  output/.style = {coordinate},
    to/.style    = {->,>=stealth', shorten >=1pt, semithick, font=small}
}
begin{tikzpicture}
  draw (0,0) -- (4,0);
end{tikzpicture}

end{document}

I use the following command:

$ pdflatex figure.tex

The execution ends successfully but the pdf file is empty.

I’m using Linux Mint and installed Textlive:

ii  texlive                                      2015.20160320-1ubuntu0.1                     all          TeX Live: A decent selection of the TeX Live packages
ii  texlive-base                                 2015.20160320-1ubuntu0.1                     all          TeX Live: Essential programs and files
ii  texlive-binaries                             2015.20160222.37495-1ubuntu0.1               amd64        Binaries for TeX Live
ii  texlive-fonts-recommended                    2015.20160320-1ubuntu0.1                     all          TeX Live: Recommended fonts
ii  texlive-latex-base                           2015.20160320-1ubuntu0.1                     all          TeX Live: LaTeX fundamental packages
ii  texlive-latex-recommended                    2015.20160320-1ubuntu0.1                     all          TeX Live: LaTeX recommended packages
ii  texlive-pictures                             2015.20160320-1ubuntu0.1                     all          TeX Live: Graphics, pictures, diagrams

What did I do wrong?

Thanks for your help!
Thierry

One Answer

The document is incomplete and can't be compiled successfully. At the very minimum, a documentclass is missing and the packages ought to be in the preamble, not in the document body:

documentclass[margin=3mm,convert]{standalone}

usepackage{tikz}
usetikzlibrary{automata, positioning, arrows, shapes}

tikzset{
  box/.style    = {draw, rectangle, minimum height = 2.5em, minimum width = 2.5em},
  circl/.style  = {draw, circle, minimum size = 8mm,label={[font=small, inner sep=1pt]200:$+$}},
  input/.style  = {coordinate},
  output/.style = {coordinate},
    to/.style    = {->,>=stealth', shorten >=1pt, semithick, font=small}
}


begin{document}


begin{tikzpicture}
  draw (0,0) -- (4,0);
end{tikzpicture}

end{document}

enter image description here

Correct answer by samcarter_is_at_topanswers.xyz on July 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP