Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a graph. This is my code.

 \documentclass[10pt]{article}
    \usepackage{pgf,tikz}
    \usetikzlibrary{arrows,patterns}
    \pagestyle{empty}

    \definecolor{ttqqcc}{rgb}{0.2,0,0.8}
    \definecolor{ffqqtt}{rgb}{1,0,0.2}
    \definecolor{ttqqff}{rgb}{0.2,0,1}
    \definecolor{uququq}{rgb}{0.25,0.25,0.25}

    \begin{document}

    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]

    \draw[->] (-3.63,0) -- (3.67,0);
    \foreach \x in {-3,-2,-1,1,2,3}
      \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) 
        node[below] {\footnotesize $\x$};
    \draw[color=black] (3.48,0.07) node [anchor=south west] { $x$};

    \draw[->] (0,-1.93) -- (0,5.57);
    \foreach \y in {-1,1,2,3,4,5}
      \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) 
        node[left] {\footnotesize $\y$};
    \draw[color=black] (0.06,5.19) node [anchor=west] { $y$};

    \draw (0pt,-10pt) node[right] {\footnotesize $0$};

    \clip(-3.63,-1.93) rectangle (3.67,5.57);
    \draw[pattern color=ffqqtt,pattern=north east lines,fill opacity=0.1, smooth,samples=50,domain=0:1.0] 
    plot(\x,{\x^4-4*\x^2+3}) -- (1,0) -- (0,0) -- cycle;
    \draw[pattern color=ttqqcc,pattern=crosshatch,fill opacity=0.1, smooth,samples=50,domain=1.0:1.7320508075688772] 
    plot(\x,{\x^4-4*\x^2+3}) -- (1.73,0) -- (1,0) -- cycle;

    \begin{scope}[xscale=-1]
    \draw[pattern color=ffqqtt,pattern=north east lines,fill opacity=0.1, smooth,samples=50,domain=0:1.0] 
      plot(\x,{\x^4-4*\x^2+3}) -- (1,0) -- (0,0) -- cycle;
    \draw[pattern color=ttqqcc,pattern=crosshatch,fill opacity=0.1, smooth,samples=50,domain=1.0:1.7320508075688772] 
      plot(\x,{\x^4-4*\x^2+3}) -- (1.73,0) -- (1,0) -- cycle;
    \end{scope}

    \draw[smooth,samples=100,domain=-3.6342419080068153:3.665758091993186] plot(\x,{(\x)^4-4*(\x)^2+3});

    \fill [color=uququq] (-1.73,0) circle (1.5pt);

    \fill [color=uququq] (-1,0) circle (1.5pt);

    \fill [color=uququq] (1,0) circle (1.5pt);

    \fill [color=uququq] (1.73,0) circle (1.5pt);

    \end{tikzpicture}
    \end{document}

When I see the DVI output DVI, I have

enter image description here

And if I look at the PDF file, I have

enter image description here

share|improve this question
3  
tikz / pgf figures never look good when viewed as dvi. Convert the dvi to ps or pdf, and everything should be alright. –  Alex Nov 25 '12 at 15:44
    
If I use Miktex 2.8, I can view the tikz / pgf figures figures in dvi. I have just installed Miktex 2.9. –  minthao_2011 Nov 25 '12 at 15:59
    
And this is file.log mediafire.com/view/?iffvz1xb9xe2zch –  minthao_2011 Nov 25 '12 at 16:09
    
Here's a post that could work for you permalink.gmane.org/gmane.comp.tex.miktex/10737 –  Alex Nov 25 '12 at 16:59
    
@Alex Can you make your comment into a full answer, please? –  egreg Mar 2 '13 at 23:16
add comment

2 Answers

up vote 8 down vote accepted

Tikz and pgf figures are based on postscript specials, i.e., postscript code is embedded within the dvi file. Most dvi-viewers can display only parts of this postscript code and the figures may look distorted or parts are missing. A few dvi-viewers, e.g. yap which is included in MiKTeX, call ghostscript to render the postscript code.

If you convert the dvi file to postscript with dvips or to PDF with dvipdf and open it with a ps- oder pdf-viewing program, you should see all figures in full beauty.

share|improve this answer
add comment

if you were using yap to view the dvi output, the following might help.

go to yap, change View->Render Method from the default Pk to Dvips, then everything is normal without compiling again. the details are beyond me, though.

share|improve this answer
    
Extremly usefull answer –  saldenisov Mar 19 at 10:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.