0

This is one of the first figures I drew with latex.

enter image description here

\documentclass[a4paper,10pt]{scrbook} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{calc} \usetikzlibrary{intersections} \usetikzlibrary{arrows} \usetikzlibrary{decorations.pathmorphing,decorations.pathreplacing,decorations.markings} \usepackage{xparse} \usetikzlibrary{angles,positioning,quotes} \usetikzlibrary{shadows} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\modul}[1]{{\left|{#1}\right|}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{figure} \begin{center} \noindent\resizebox{1.3\textwidth}{!}{ \begin{tikzpicture} %[scale=1/2] % Parallelogram % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:3); %Omega_1 \coordinate (D) at (70:2); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped,scale=3.0] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped,scale=3.0] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=2,angle radius=9mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \draw[dashed,thick,fill=green,fill opacity=0.2] (A) -- (B) -- (C) -- (D) -- cycle; \node [below=1cm, align= flush center,text width=8cm,scale=2.0] at ($(1,-1.5)$) { Oblique \\ $\modul{\omega_1} \neq \modul{\omega_2}$, and $\varphi \neq \frac{\pi}{2}$ }; \end{tikzpicture} \hspace{2cm} \begin{tikzpicture} %[scale=1/2] % Rectangular % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:3); %Omega_1 \coordinate (D) at (90:1.8); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \draw[dashed,thick,fill=green,fill opacity=0.2] (A) -- (B) -- (C) -- (D) -- cycle; \node [below=1cm, align= flush center,text width=8cm,scale=2.0] at ($(1.5,-1.5)$) { Rectangular \\ $\modul{\omega_1} \neq \modul{\omega_2}$, and $\varphi = \frac{\pi}{2}$ }; \end{tikzpicture} \hspace{2cm} \begin{tikzpicture} %[scale=1/2] % Rhombic \begin{scope} % lattice coordinates scaled to 60% \clip (-3,-1.6) rectangle (8,4.6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (-38:2.2); %Omega_1 \coordinate (D) at (38:2.2); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-2,-1,...,3.1} \foreach \b in {-1,-0,...,4.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; \end{scope} % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \coordinate (E) at (A); \coordinate (F) at (C); \coordinate (H) at ($(D) - (B)$); \coordinate (G) at ($(F) +(H)$); \draw[dashed,thick,fill=green,fill opacity=0.2] (E) -- (F) -- (G) -- (H) -- cycle; \node [below=1cm, align= flush center,text width=8cm,scale=2.0] at ($(2.5,-1.5)$) { Rhobic \\ $\modul{\omega_1} = \modul{\omega_2}$, and $\varphi \neq \frac{\pi}{2}, \frac{\pi}{3}$ }; \end{tikzpicture}} \vspace*{2cm} \noindent\resizebox{0.9\textwidth}{!}{\begin{tikzpicture} %[scale=1/2] % Square % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:2); %Omega_1 \coordinate (D) at (90:2); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \draw[dashed,thick,fill=green,fill opacity=0.2] (A) -- (B) -- (C) -- (D) -- cycle; \node [below=1cm, align= flush center,text width=8cm,scale=2.0] at ($(1,-1.5)$) { Square \\ $\modul{\omega_1} = \modul{\omega_2}$, and $\varphi = \frac{\pi}{2}$ }; \end{tikzpicture} \hspace{2cm} \begin{tikzpicture} %[scale=2/5] % Hexagonal % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:2.8); %Omega_1 \coordinate (D) at (60:2.8); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \coordinate (E) at (B); \coordinate (F) at (D); %Omega_1 \coordinate (G) at ($(D) - (B)$); %Omega_2 \coordinate (H) at ($(A) -(B)$); \coordinate (I) at ($(A) -(D)$); %Omega_2 \coordinate (J) at ($(A) -(G)$); \draw[dashed,thick,fill=green,fill opacity=0.2] (E) -- (F) -- (G) -- (H) --(I) -- (J) -- cycle; \node [below=1cm, align= flush center,text width=8cm,scale=2.0] at ($(2,-1.5)$) { Hexagonal \\ $\modul{\omega_1} = \modul{\omega_2}$, and $\varphi \neq \frac{\pi}{3}$ }; \end{tikzpicture} } \end{center} \caption{Lattices as classified by Barvais} \label{fig:prime-sum-of-squares} \end{figure} \end{document} 

As you see In the code, I have 5 tikzpictures, I want to place tree in the first line and two in the second. After some research in the questions here I find a solution using \noindent\resizebox{1.3\textwidth}{!}{"somthing to place in the line"}. And I was satisfied before adding the description of each lattice as a node of the form

\node [below=1cm, align= flush center,text width=8cm] at ($(2,-1.5)$) { Hexagonal \\ $\modul{\omega_1} = \modul{\omega_2}$, and $\varphi \neq \frac{\pi}{3}$ }; 

After adding this line of code in each picture, the figures become smaller, and I tried to correct that by changing the scaling of the tikzpictures and and also adding ,scale=2.0 to the description nods. after several attempt I remarked an other problem, it is that the angle name ("\varphi") didn't follow the scaling and still very small.

What do you think about my problem? and what is the best way to place figures in one line and adjust the scaling, and especially how I can adjust the size of the angle $\varphi$?

3
  • You can remove the text width=8cm for each caption, it should solve your problem (if I understand your question). Commented Aug 18, 2015 at 12:14
  • I removed it but the problem withe the size of $\varphi$ didn't change. Commented Aug 18, 2015 at 12:21
  • One dirty fix: scale=3, transform shape,angle eccentricity=2,angle radius=3mm. I'd remove every scale parameters for the fonts, and set scale=0.5 for the tikzpicture already. It will downsize everything except the fonts, so they will get bigger. Commented Aug 18, 2015 at 12:26

1 Answer 1

3

I control the size of the plot using scale= and the size of the font using font= for each tikzpicture. I use \hfil to provide space between the plots. Each \hfil expands to the same size until the line is filled. There is an automatic \hfil (okay, \parendskip) at the end of the paragraph.

I'm not sure what you were trying to accomplish by making the "label" nodes 8cm wide.

\documentclass[a4paper,10pt]{scrbook} \usepackage[utf8]{inputenc} \usepackage{showframe} \usepackage{tikz} \usetikzlibrary{calc} \usetikzlibrary{intersections} \usetikzlibrary{arrows} \usetikzlibrary{decorations.pathmorphing,decorations.pathreplacing,decorations.markings} \usepackage{xparse} \usetikzlibrary{angles,positioning,quotes} \usetikzlibrary{shadows} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\modul}[1]{{\left|{#1}\right|}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{figure} \hfil\begin{tikzpicture}[scale=0.3,font=\scriptsize] % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:3); %Omega_1 \coordinate (D) at (70:2); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; % Type of lattice parallelogram \draw[dashed,thick,fill=green,fill opacity=0.2] (A) -- (B) -- (C) -- (D) -- cycle; \node [below=1cm, align= flush center] at ($(1,-1.5)$) {Oblique\\$\modul{\omega_1} \neq \modul{\omega_2}$, and $\varphi \neq \frac{\pi}{2}$}; \end{tikzpicture}\hfil%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[scale=0.3,font=\scriptsize] % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:3); %Omega_1 \coordinate (D) at (90:1.8); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; % Type of lattice parallelogram \draw[dashed,thick,fill=green,fill opacity=0.2] (A) -- (B) -- (C) -- (D) -- cycle; \node [below=1cm, align= flush center] at ($(1.5,-1.5)$) {Rectangular\\$\modul{\omega_1} \neq \modul{\omega_2}$, and $\varphi = \frac{\pi}{2}$}; \end{tikzpicture}\hfil%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[scale=0.3,font=\scriptsize] \begin{scope} % lattice coordinates scaled to 60% \clip (-3,-1.6) rectangle (8,4.6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (-38:2.2); %Omega_1 \coordinate (D) at (38:2.2); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-2,-1,...,3.1} \foreach \b in {-1,-0,...,4.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; \end{scope} % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \coordinate (E) at (A); \coordinate (F) at (C); \coordinate (H) at ($(D) - (B)$); \coordinate (G) at ($(F) +(H)$); \draw[dashed,thick,fill=green,fill opacity=0.2] (E) -- (F) -- (G) -- (H) -- cycle; \node [below=1cm, align= flush center] at ($(2.5,-1.5)$) {Rhobic \\ $\modul{\omega_1} = \modul{\omega_2}$, and $\varphi \neq \frac{\pi}{2}, \frac{\pi}{3}$}; \end{tikzpicture}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \par\vspace{1cm}\hfil \begin{tikzpicture}[scale=0.3,font=\scriptsize] % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:2); %Omega_1 \coordinate (D) at (90:2); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \draw[dashed,thick,fill=green,fill opacity=0.2] (A) -- (B) -- (C) -- (D) -- cycle; \node [below=1cm, align= flush center] at ($(1,-1.5)$) {Square\\$\modul{\omega_1} = \modul{\omega_2}$, and $\varphi = \frac{\pi}{2}$}; \end{tikzpicture}\hfil%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[scale=0.3,font=\scriptsize] % lattice coordinates scaled to 60% %\clip (-5,-6) rectangle (5,6); %Parallelogram ABCD and its diagonals are drawn. \coordinate (A) at (0,0); \coordinate (B) at (0:2.8); %Omega_1 \coordinate (D) at (60:2.8); %Omega_2 \coordinate (C) at ($(B) +(D)$); %Lattice creation \foreach \a in {-1,-0,...,2.1} \foreach \b in {-1,-0,...,2.1} %\fill ($\a*(B) + \b*(D)$) circle[radius=4pt]; \shadedraw [ball color = gray] ($\a*(B) + \b*(D)$) circle[radius=7pt]; % Fundamental prallelogram \draw[thick,>=stealth,->] (0,0) -- (B) node[midway,below,sloped] {$\omega_1$}; \draw[thick,>=stealth,->] (0,0) -- (D) node[midway,above,sloped] {$\omega_2$}; \draw (A) -- (B) -- (C) -- (D) -- cycle; % \draw (0,0) node[below] {$0$}; %\bisector[draw]{B}{A}{C} \draw pic["$\varphi$",draw,angle eccentricity=1.6,angle radius=3mm] {angle=B--A--D}; %pic[draw,red,thick,angle radius=3mm] {angle = B--A--D} % Type of lattice parallelogram \coordinate (E) at (B); \coordinate (F) at (D); %Omega_1 \coordinate (G) at ($(D) - (B)$); %Omega_2 \coordinate (H) at ($(A) -(B)$); \coordinate (I) at ($(A) -(D)$); %Omega_2 \coordinate (J) at ($(A) -(G)$); \draw[dashed,thick,fill=green,fill opacity=0.2] (E) -- (F) -- (G) -- (H) --(I) -- (J) -- cycle; \node [below=1cm, align= flush center] at ($(2,-1.5)$) {Hexagonal\\$\modul{\omega_1} = \modul{\omega_2}$, and $\varphi \neq \frac{\pi}{3}$}; \end{tikzpicture} \end{figure} \end{document} 

rows of 3 and 2

If you use \hfill instead of \hfil you can ignore the \parendskip and force the first row to go from border to border. (It's still there, just too thin to notice.)

2
  • Thank you very much. I just forgot to remove it after copy\past from an other code ;). I like your way using \hfill, and I wonder if it is possible to get (the figure environment ) over the margin using it. what is it for \parendskip, I tried to look for documentation and I don't find any. Commented Aug 19, 2015 at 10:34
  • If you want to go over the margins, use an oversized minipage with negative \hspace before and after.. Commented Aug 19, 2015 at 13:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.