在一行中缩放多个tikz图片的问题

在一行中缩放多个tikz图片的问题

这是我使用乳胶绘制的第一个图形之一。

在此处输入图片描述

\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}

如您所见,在代码中,我有 5 张 tikzpictures,我想在第一行放置树,在第二行放置两张。在对这里的问题进行一些研究后,我找到了一个解决方案\noindent\resizebox{1.3\textwidth}{!}{"somthing to place in the line"}。在将每个格子的描述添加为以下形式的节点之前,我很满意

\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}$  };
     

在每张图片中添加这行代码后,图形变得更小,我尝试通过改变 tikzpictures 的比例并添加,scale=2.0 描述点头来纠正这个问题。经过几次尝试,我注意到另一个问题,那就是角度名称(“\varphi”)没有遵循缩放比例并且仍然非常小。

您如何看待我的问题?将图形放在一行中并调整缩放比例的最佳方法是什么,尤其是如何调整角度$ \ varphi $的大小?

答案1

我使用 控制绘图的大小,使用 控制每个scale=字体的大小。我使用来在绘图之间留出空间。每个绘图都会扩展到相同的大小,直到填满一行。段落末尾有一个自动(好的, )。font=tikzpicture\hfil\hfil\hfil\parendskip

我不确定您通过将“标签”节点设置为 8 厘米宽想要实现什么目的。

\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}

3 行和 2 行

如果使用\hfill而不是,则\hfil可以忽略\parendskip并强制第一行从边界到边界。(它仍然在那里,只是太薄而无法注意到。)

相关内容