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.

This question doesn't entirely make sense because I know I don't need to call driver=dvips. But I would like to know whether anyone can explain what's happening.

A little background

I'm trying to learn tikz. So, I decided to take some old documents containing---what I thought were simple---graphics I created using pstricks and rewrite them using tikz.

Being a creature of habit, I was going the latex->dvips->ps2pdf (I have a shell script which handles this. So, this is usually very unconscious on my part.) But then I was trying things with tikz (such as using spy) which didn't seem to like this route. I remembered I should just being using pdflatex with tikz.

Also, I'd forgotten about some of the other bells-and-whistles I normally load to get pstricks to work correctly: one of which was to load the driver dvips.

So this is what I noticed:

If I compile (using pdflatex) this first MWE, everything works quite well---even though I'm calling the driver dvips. (The tikz code is from van Dongen's new book.)

\documentclass{article}
\usepackage[driver=dvips,
            landscape,
            twocolumn,
           ]{geometry}
\usepackage{tikz}
\usetikzlibrary{spy}
\usepackage{showframe}
\usepackage{lipsum}
\begin{document}

\begin{tikzpicture}
    [spy using outlines={circle,
                         magnification=2.5,
                         size=3cm,
                         connect spies}]
    \begin{scope}
    [spy using outlines={circle,
                         magnification=3,
                         size=3.5cm,
                         red,
                         connect spies}]
    \draw (-36:0.8)
          \foreach \angle in {0,36,...,359}{
                -- (\angle:0.8)
                   (\angle:1.1) node {$\angle$}
                   (0,0) -- (\angle:0.8)
            };
        \spy on (167:1) in node (zoom) at (-30:5.5);
    \end{scope}
    \spy[blue] on (zoom) in node [right] at (-135:4.5);

\end{tikzpicture}

\lipsum[1-5]

\end{document}

But I was sloppy with loading packages once and got frustrated that my landscape directive to geometry seemed to be ignored in the final pdf document.

Here's the MWE for this fail where the only difference with the previous MWE is when I call \usepackage{tikz}. (Still compiling using pdflatex.)

\documentclass{article}
\usepackage{tikz}
\usepackage[driver=dvips,
            landscape,
            twocolumn,
           ]{geometry}
\usetikzlibrary{spy}
\usepackage{showframe}
\usepackage{lipsum}
\begin{document}

\begin{tikzpicture}
    [spy using outlines={circle,
                         magnification=2.5,
                         size=3cm,
                         connect spies}]
    \begin{scope}
    [spy using outlines={circle,
                         magnification=3,
                         size=3.5cm,
                         red,
                         connect spies}]
    \draw (-36:0.8)
          \foreach \angle in {0,36,...,359}{
                -- (\angle:0.8)
                   (\angle:1.1) node {$\angle$}
                   (0,0) -- (\angle:0.8)
            };
        \spy on (167:1) in node (zoom) at (-30:5.5);
    \end{scope}
    \spy[blue] on (zoom) in node [right] at (-135:4.5);


\end{tikzpicture}

\lipsum[1-5]

\end{document}

There are no problems if I get rid of the driver=dvips call. So, please no explanations that I don't need that driver. But what I would like to know is: why there's only an apparent conflict with the driver if tikz is called before I call the driver?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

If you load geometry with the faulty dvips driver then it doesn't set the lengths responsable for the "pdf-background" \pdfpagewidth and \pdfpageheight and so they keep their default value (set today normally in the format). In my case this is a4 portrait (even if I add some paper option like letterpaper).

If you additionally load tikz it will load graphicx which in turn will set \pdfpagewidth and \pdfpageheight to the current values of \paperwidth and paperheight – which are before geometry in your example "letterpaper portrait" and after geometry "letterpaper landscape".

share|improve this answer

The problem is that tikz most likely also specifies what driver it wants to use in a semi-automatic way. From what I can see, its probably selecting pdftex.

So what is happening is the following:

Fail: Load Tikz -> driver=pdftex -> Load Geometry -> driver=dvips

Success: Load Geometry -> driver=dvips -> Load Tikz -> driver=pdftex

Since the code works in the second case, it is likely that the dvips driver messes up a page setting in some way, which affects the end result. For instance, if you change in the second answer driver=dvips to driver=pdftex, it works fine.

In short, the main issue is that both packages specify the driver to use in some way, which is why the order matters for the result. This also depends on what processor you use (pdflatex, etc) since they expect different drivers to be used for correct results.

share|improve this answer

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.