# using grid from Tikz in Texmaker

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.

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

-
Are you using the same zoom levels? –  percusse Jun 30 '12 at 16:50
yes. I'm sorry I have not enought reputations to add images. First I thought there was a colorpackage missing. But it's all there. –  wieschoo Jun 30 '12 at 16:56
@wieschoo Just upload your image to ifile.it and post a link. One of the regular users will edit it in! :) –  kan Jun 30 '12 at 17:04
–  wieschoo Jun 30 '12 at 17:06
I just tested your code in both texmaker and tikzedt and they produce the desired output. –  azetina Jun 30 '12 at 17:06

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

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}


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}


-
That's cool. I only have to find a permutation of the commands. Your are "densely dotted" looks much better. –  wieschoo Jun 30 '12 at 18:03
While I prefer dashed,color=gray!30!white ;) Great answer –  N3buchadnezzar Jun 30 '12 at 19:47

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:

Texmaker:

Note: I am using SumatraPDF viewer.

-
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 tex.stackexchange.com/questions/60916/… 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