[Tex/LaTex] How to center horizontally but not vertically

diagramshorizontal alignmentvertical alignment

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

Best Answer

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}