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 want to draw a small cross at the horizontal and vertical center of my page. (at this position I want to glue in a CD). Should I create an image with a cross and center it or draw it directly with latex?

share|improve this question
    
Cna you share with us your file to sse how you do ? –  projetmbc Oct 28 '11 at 10:12
    
I just exactly the version from wh1t3 –  strauberry Oct 28 '11 at 14:49

2 Answers 2

up vote 16 down vote accepted

The easiest way I know of is using Tikz. You can use the current page node and its center anchor like this:

\documentclass{article}
\usepackage{tikz}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[overlay, remember picture]
  \node at (current page.center) {$\times$};
\end{tikzpicture}
\end{document}

This will draw a small cross at the center of the page. You need to run it twice to get the correct location. The result looks like this:

Centered X

Update As per @Dror's request some additional information on why the remember picture and overlay specification are required. This is specified in sections 75.3.2 and 75.4 of the manual. The gist of it is, the current page node resides in a virtual remembered picure. So when we use it in our picture, we are really referencing a node in a different picture. Therefore Tikz can't manage anymore with only the relative positions used within a picture, it also needs to know the relative position of the current picture and the virtual picture the current page node is in. Now because the absolute position on the page only becomes known after compiling the document, these positions have to be remembered. They are written to the aux file when we use the overlay and remember picture options. Why the overlay? The manual doesn't specify as far as I know, but I presume it's because if we don't use overlay two pictures could keep influencing each other on sequential passes (if they reference anchors inside each other). These remembered abolute positions then allow for references to nodes in different pictures on the next pass.

share|improve this answer
    
Very cool, thank you :-) –  strauberry Oct 28 '11 at 7:48
    
@wh1t3: Can you add an explanation why did you used the overlay, remember picture options? –  Dror Oct 28 '11 at 9:02
1  
@Dror, I've added a 'short' explanation. Let me know if this answers your question. –  Roelof Spijker Oct 28 '11 at 9:16
    
Option overlay produces a zero-width-zero-height box from tikzpicture environment. That is, it is overlaid over the page content. –  AlexG Oct 28 '11 at 10:22
    
Yes, the manual does specify what the overlay option is for and what it does. It does not, however, explain why it is needed if we want to reference a node from a different picture. At least, to the best of my knowledge. So I can only guess, which is what I have done. –  Roelof Spijker Oct 28 '11 at 11:34
\documentclass{article}
\usepackage{eso-pic} 

\pagestyle{empty}

\begin{document}
  \null\AddToShipoutPicture*{\AtPageCenter{$\times$}}
\end{document}
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.