Graphics, Figures & TablesDrawing a lattice/grid

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
niles
Posts: 92
Joined: Mon Dec 01, 2008 9:35 pm

Drawing a lattice/grid

Post by niles »

Hi guys

I wish to visualize a lattice in my document (i.e. a grid). What I am searching for is something like the attached picture.

I've been toying a little with Tikz, but I did not get a useful result. Mainly because I think the text inside the circles is too big. I have tried using [font=\small], but it' still a little too big.

Do you have any suggestion on how I should create this?

Sincerely,
Niles.
Attachments
grid.PNG
grid.PNG (3.79 KiB) Viewed 5799 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Drawing a lattice/grid

Post by localghost »

What you want is a matrix. For this special purpose with math expressions you have to use the »matrix« library. See Section 31 (Matrix Library, p. 278ff) of the pgf/tikZ manual and the code below.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
  \begin{tikzpicture}
    \matrix [
      matrix of math nodes,
      nodes={circle,draw},
      minimum size=1.2cm,
      inner sep=1mm,
      column sep=5mm,
      row sep=5mm
    ]
      {
        1 & 2 & \vphantom{1}\ldots & N_x \\
        N_{x+1} & N_{x+2} & \vphantom{1}\ldots & \vphantom{1}\ldots \\
        \phantom{1} & \vphantom{1}\ldots & \vphantom{1}\ldots & \phantom{1} \\
      };
  \end{tikzpicture}
\end{document}
Please give final feedback to provided solutions. Until now you haven't done that to none of your requests.


Best regards
Thorsten
niles
Posts: 92
Joined: Mon Dec 01, 2008 9:35 pm

Re: Drawing a lattice/grid

Post by niles »

Thanks. That is exactly what I am looking for.

Have a nice day.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Drawing a lattice/grid

Post by localghost »

niles wrote:[...] Have a nice day.
There's not much left of the day. It's 11:25pm here.
niles
Posts: 92
Joined: Mon Dec 01, 2008 9:35 pm

Drawing a lattice/grid

Post by niles »

localghost wrote:
niles wrote:[...] Have a nice day.
There's not much left of the day. It's 11:25pm here.
:)

Well, in that case have a nice evening
Post Reply