7

This centers both horizontally and vertically, but I do not want vertical centering. I want the grid to be at the top of the page. (The geometry package works well at defining margins though).

\documentclass{article}
\usepackage[margin=5pt,nohead]{geometry}
\usepackage{tikz}
\usepackage{caption}

\begin{document}
\begin{figure}[ht]
 \begin{centering}

   \begin{tikzpicture}[scale=(3/10)]

      \draw[help lines] (0,0) grid (670mm,700mm);

    \end{tikzpicture}

  \caption{some caption here}

  \end{centering}
\end{figure}
\clearpage
\end{document}

Thanks

3
  • Do you need it to be floating or should it be in a fixed position in the document?
    – Stefan Kottwitz
    Nov 30, 2010 at 22:25
  • Not sure, but I do need room at bottom for captions. I think fixed is ok cause evry page will be the same , just one picture.
    – Douglass
    Nov 30, 2010 at 22:26
  • In this case a figure environment is not required. figures like here may be vertically centered on float pages. But I edit my answer to be more detailed.
    – Stefan Kottwitz
    Nov 30, 2010 at 22:31

1 Answer 1

5

One single character would make a difference: try \begin{figure}[ht!] instead. By adding this option the picture would float to the top of the page.

However, because the picture doesn't need to float across page borders and should be just at the top, you don't need a figure environment. Instead, you could use the \captionof command of the caption package, which you're already loading. Here's a small example based on your code:

\documentclass{article}
\usepackage[margin=5pt,nohead]{geometry}
\usepackage{tikz}
\usepackage{caption}
\begin{document}
\begin{centering}
  \begin{tikzpicture}[scale=(3/10)]
    \draw[help lines] (0,0) grid (670mm,700mm);
  \end{tikzpicture}
  \captionof{figure}{some caption here}
\end{centering}
\end{document}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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