3

I use Tikz for creating figures. But there is a problem. If I use for example

\begin{tikzpicture}
\draw[->] (0,0)--(10,0);
\draw[->] (0,0)--(0,10);
\draw[help lines] (-0.1,-0.1) grid (9.9,9.9); 
\draw[thick] (0,0) -- (4,4) -- (5,9) -- (0,0);
\end{tikzpicture}

in TikzEdt then the lines from the grid are grey. But If I use the code in Texmaker then the grid lines are all black and looks like the lines from the axes.

enter image description here enter image description here

Both programs use pdflatex. I can't find out why they gave me different results. I also copy the preamble from tikzedt to texmaker.

percusse
  • 157,807

2 Answers2

2

One problem is that you first draw the axes, and then the grid over it, which you see nicely at high magnification:

enter image description here


You can solve it by reversing the order of the commands:

\begin{tikzpicture}[scale=0.7]
\draw[help lines] (-0.1,-0.1) grid (9.9,9.9); 
\draw[->] (0,0)--(10,0);
\draw[->] (0,0)--(0,10);
\draw[thick] (0,0) -- (4,4) -- (5,9) -- (0,0);
\end{tikzpicture}

enter image description here


Personally, I prefer non-solid lines, e.g. densely dotted

\begin{tikzpicture}[scale=0.7]
\draw[densely dotted] (-0.1,-0.1) grid (9.9,9.9); 
\draw[->] (0,0)--(10,0);
\draw[->] (0,0)--(0,10);
\draw[thick] (0,0) -- (4,4) -- (5,9) -- (0,0);
\end{tikzpicture}

enter image description here

Tom Bombadil
  • 40,123
1

The only thing that I can think of that is causing this effect would be the viewer of choice or the update you have for your packages but that shouldn't be the case. The following are the results I get with:

TikzEdt 0.2:

enter image description here

Texmaker:

enter image description here

Note: I am using SumatraPDF viewer.

azetina
  • 28,884
  • thats the problem, but this doesn't solve it. The internal viewer from tikzedt produce the right output but if I choose "Show output in a external viewer" the grid is black again. So the grid is only grey in the internal viewer. How does tikz work with the adobe reader? – wieschoo Jun 30 '12 at 17:16
  • @wieschoo I don't think the gray output is the right one as long as you did not specify \draw[gray,...] etc. There is an issue with the PDF viewers about the anti-aliasing effects. See for example http://tex.stackexchange.com/questions/60916/overlapping-lines-get-thicker-in-tikz and other linked questions. – percusse Jun 30 '12 at 17:46
  • Ok. In the german version of "adobe reader" the option "Dünne Linien deutlicher darstellen" was activated, which means "show thin lines more significant" (my translation). But this isn't satisfying for me. – wieschoo Jun 30 '12 at 19:04
  • @percusse: According to the manual, help lines is defined as line width=0.2pt,gray. – Caramdir Jun 30 '12 at 20:20
  • @wieschoo: You can't influence Acrobat Reading settings from withing the pdf. Rasterizing vector graphics on a screen (which usually has a relatively low resolution) is always a trade-off and different programs might choose to display things differently. On a (good) printer the document usually looks much better. – Caramdir Jun 30 '12 at 20:22
  • @Caramdir As a colorblind, that means I failed fantastically :) – percusse Jun 30 '12 at 20:59