tikz 그림을 원하는 대로 왼쪽, 오른쪽, 위, 아래로 배치하는 방법은 무엇입니까?

tikz 그림을 원하는 대로 왼쪽, 오른쪽, 위, 아래로 배치하는 방법은 무엇입니까?

여기에 이미지 설명을 입력하세요

\documentclass[12pt]{article}
\usepackage[a4paper,left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\usepackage{fontspec}
\usepackage[dvipsnames]{xcolor}
\usepackage[object=vectorian]{pgfornament} % also loads tikz
\usepackage{labels}

\setmainfont{Holden}
\tikzset{pgfornamentstyle/.style={draw = Periwinkle,
                                  fill = SpringGreen}}

\usetikzlibrary{
  positioning, % for left=of, above=of etc.
  calc % for let syntax used in second example
}
\LabelCols=3%         Number of columns of labels per page
\LabelRows=7%         Number of rows of labels per page
\LeftBorder=8mm%      Space added to left border of each label
\RightBorder=8mm%     Space added to right border of each label
\TopBorder=9mm%       Space to leave at top of sheet
\BottomBorder=2mm%    Space to leave at bottom of sheet
\numberoflabels=22
\begin{document}
% \begin{labels}
% \begin{center}
\begin{tikzpicture}[
  every node/.append style={inner sep=0},
  node distance=5mm
]
   \node [Black] (text) {Vaijan\XeTeXglyph83s Honey};



  \path
    let
    \p1=(text.south west),
    \p2=(text.north east),
    \n1={\x2-\x1}, % width of text node
    \n2={\y2-\y1}  % height of text node
    in
% in all of the below some fraction of \n1 or \n2 is used to define the width of the ornaments
% set width of these ornaments to half the text node's width
   node [anchor=north] (below) at (text.south) {\pgfornament[width=0.5*\n1,symmetry=c]{69}}
   node [anchor=south] (above) at (text.north) {\pgfornament[width=0.5*\n1]{69}}



% use \n2 for ornament width here
   node [rotate=-90, left=of text, anchor=north] (left)  {\pgfornament[width=\n2]{46}}
   node [rotate=90, right=of text, anchor=north] (right) {\pgfornament[width=\n2]{46}}
% and \n1 here
   node [above=of above] (top)    {\pgfornament[width=\n1]{71}}
   node [below=of below] (bottom) {\pgfornament[width=\n1,symmetry=h]{71}}
%   node [anchor=north] (top) at (text.north)   {\pgfornament[width=\n1]{71}}
%   node [anchor=south] (bottom) at (text.south) {\pgfornament[width=\n1,symmetry=h]{71}}
% and 25% of width for the corner ornaments
   node [anchor=north west] at (top.north -| left.south)  {\pgfornament[width=0.25*\n1]{63}}
   node [anchor=north east] at (top.north -| right.south) {\pgfornament[width=0.25*\n1,symmetry=v]{63}}
   node [anchor=south west] at (bottom.south -| left.south) {\pgfornament[width=0.25*\n1,symmetry=h]{63}}
   node [anchor=south east] at (bottom.south -| right.south) {\pgfornament[width=0.25*\n1,symmetry=c]{63}}; % <- note the \path doesn't end until here

   % draw frame
  \draw [Blue] (current bounding box.south west) rectangle (current bounding box.north east);
  \vspace{2cm};
  \node [anchor=south] (bellowaddress1) at (below.south) {\pgfornament[width=0.10*\textwidth]{88}};
  \setmainfont{Linux Biolinum O}
  \tiny
  \node [Brown, below, align=center] (bellowaddress3) at (bellowaddress1.south) {Md.Al-Helal, CSE, DU\\ 01515611989};
  \node [anchor=south, below] (bellowaddress2) at (bellowaddress3.south) {\pgfornament[width=0.10*\textwidth]{88}};
\end{tikzpicture}
% \end{center}
% \end{labels}
\end{document}

텍스트를 위쪽보다 약간 위쪽에 배치하면 간격이 최소화됩니다. 어떻게 해야 하나요?

답변1

제거 node distance=5mm하고 추가합니다node [above=0mm of above] (top) {\pgfornament[width=\n1]{71}}

\documentclass[12pt]{article}
\usepackage[a4paper,left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\usepackage{fontspec}
\usepackage[dvipsnames]{xcolor}
\usepackage[object=vectorian]{pgfornament} % also loads tikz
\usepackage{labels}

\setmainfont{Holden}
\tikzset{pgfornamentstyle/.style={draw = Periwinkle,
                                  fill = SpringGreen}}

\usetikzlibrary{
  positioning, % for left=of, above=of etc.
  calc % for let syntax used in second example
}
\LabelCols=3%         Number of columns of labels per page
\LabelRows=7%         Number of rows of labels per page
\LeftBorder=8mm%      Space added to left border of each label
\RightBorder=8mm%     Space added to right border of each label
\TopBorder=9mm%       Space to leave at top of sheet
\BottomBorder=2mm%    Space to leave at bottom of sheet
\numberoflabels=22
\begin{document}
% \begin{labels}
% \begin{center}
\begin{tikzpicture}[
  every node/.append style={inner sep=0},
  node distance=5mm
]
   \node [Black] (text) {Vaijan's Honey};



  \path
    let
    \p1=(text.south west),
    \p2=(text.north east),
    \n1={\x2-\x1}, % width of text node
    \n2={\y2-\y1}  % height of text node
    in
% in all of the below some fraction of \n1 or \n2 is used to define the width of the ornaments
% set width of these ornaments to half the text node's width
   node [anchor=north] (below) at (text.south) {\pgfornament[width=0.5*\n1,symmetry=c]{69}}
   node [anchor=south] (above) at (text.north) {\pgfornament[width=0.5*\n1]{69}}

% use \n2 for ornament width here
   node [rotate=-90, left=of text, anchor=north] (left)  {\pgfornament[width=\n2]{46}}
   node [rotate=90, right=of text, anchor=north] (right) {\pgfornament[width=\n2]{46}}
% and \n1 here
   node [above=0mm of above] (top)    {\pgfornament[width=\n1]{71}}
   node [below=of below] (bottom) {\pgfornament[width=\n1,symmetry=h]{71}}
%   node [anchor=north] (top) at (text.north)   {\pgfornament[width=\n1]{71}}
%   node [anchor=south] (bottom) at (text.south) {\pgfornament[width=\n1,symmetry=h]{71}}
% and 25% of width for the corner ornaments
   node [anchor=north west] at (top.north -| left.south)  {\pgfornament[width=0.25*\n1]{63}}
   node [anchor=north east] at (top.north -| right.south) {\pgfornament[width=0.25*\n1,symmetry=v]{63}}
   node [anchor=south west] at (bottom.south -| left.south) {\pgfornament[width=0.25*\n1,symmetry=h]{63}}
   node [anchor=south east] at (bottom.south -| right.south) {\pgfornament[width=0.25*\n1,symmetry=c]{63}}; % <- note the \path doesn't end until here

   % draw frame
  \draw [Blue] (current bounding box.south west) rectangle (current bounding box.north east);
  \vspace{2cm};
  \node [anchor=south] (bellowaddress1) at (below.south) {\pgfornament[width=0.10*\textwidth]{88}};
  \setmainfont{Linux Biolinum O}
  \tiny
  \node [Brown, below, align=center] (bellowaddress3) at (bellowaddress1.south) {Md.Al-Helal, CSE, DU\\ 01515611989};
  \node [anchor=south, below] (bellowaddress2) at (bellowaddress3.south) {\pgfornament[width=0.10*\textwidth]{88}};
\end{tikzpicture}
% \end{center}
% \end{labels}
\end{document}

여기에 이미지 설명을 입력하세요

답변2

Ti를 사용하면서케이Z positioning라이브러리를 사용하면 \usetikzlibrary{positioning}다음을 수행할 수 있습니다.

\path ... node [above=1.5mm of above] (top) {...}

을 지정하지 않으면 예제에 있는 1.5mmnode distance사용됩니다 (따라서 훨씬 더 큼).5mm

전체 코드:

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage[object=vectorian]{pgfornament} % also loads tikz
\usetikzlibrary{calc, positioning}
\usepackage{labels}

\tikzset{pgfornamentstyle/.style={draw = Periwinkle,
                                  fill = SpringGreen}}

\LabelCols=3%         Number of columns of labels per page
\LabelRows=7%         Number of rows of labels per page
\LeftBorder=8mm%      Space added to left border of each label
\RightBorder=8mm%     Space added to right border of each label
\TopBorder=9mm%       Space to leave at top of sheet
\BottomBorder=2mm%    Space to leave at bottom of sheet
\numberoflabels=22

\begin{document}

\begin{tikzpicture}[
  every node/.append style={inner sep=0},
  node distance=5mm,
]
  \node [black] (text) {Vaijan\XeTeXglyph83s Honey};
  \path
    let
    \p1=(text.south west),
    \p2=(text.north east),
    \n1={\x2-\x1}, % width of text node
    \n2={\y2-\y1}  % height of text node
    in
   % In all of the below, some fraction of \n1 or \n2 is used to define the
   % width of the ornaments set width of these ornaments to half the text
   % node's width.
   node [anchor=north] (below) at (text.south) {\pgfornament[width=0.5*\n1,symmetry=c]{69}}
   node [anchor=south] (above) at (text.north) {\pgfornament[width=0.5*\n1]{69}}

   % Use \n2 for ornament width here.
   node [rotate=-90, left=of text, anchor=north] (left)  {\pgfornament[width=\n2]{46}}
   node [rotate=90, right=of text, anchor=north] (right) {\pgfornament[width=\n2]{46}}
   % And \n1 here
   node [above=1.5mm of above] (top)    {\pgfornament[width=\n1]{71}}
   node [below=of below] (bottom) {\pgfornament[width=\n1,symmetry=h]{71}}
   node [anchor=north west] at (top.north -| left.south)
     {\pgfornament[width=0.25*\n1]{63}}
   node [anchor=north east] at (top.north -| right.south)
     {\pgfornament[width=0.25*\n1,symmetry=v]{63}}
   node [anchor=south west] at (bottom.south -| left.south)
     {\pgfornament[width=0.25*\n1,symmetry=h]{63}}
   node [anchor=south east] at (bottom.south -| right.south)
     {\pgfornament[width=0.25*\n1,symmetry=c]{63}}; % <- note the \path
                                                    %    doesn't end until here

  % Draw frame
  \draw [blue] (current bounding box.south west) rectangle
               (current bounding box.north east);
  \node [anchor=south] (bellowaddress1) at (below.south)
    {\pgfornament[width=0.10*\textwidth]{88}};
  \node [font=\tiny, Brown, below, align=center]
    (bellowaddress3) at (bellowaddress1.south)
    {Md.Al-Helal, CSE, DU\\ 01515611989};
  \node [anchor=south, below] (bellowaddress2) at (bellowaddress3.south)
    {\pgfornament[width=0.10*\textwidth]{88}};
\end{tikzpicture}

\end{document}

문서에 지정된 정확한 글꼴이 없는 스크린샷(나는 글꼴이 없지만 답변에는 영향을 미치지 않습니다):

여기에 이미지 설명을 입력하세요

추신:

  • Ti 사이 \vspace에는 사용하지 마십시오 .tikzpicture케이Z 진술;

  • 옵션을 사용하여 font=\tinyTi의 글꼴 크기 변경케이\tinyTi 사이가 아닌 Z 노드케이Z 진술.

\XeTeXglyph83를 a 로 바꾸면 '레이블에 기본 글꼴로 적절한 아포스트로피가 표시됩니다.

적절한 아포스트로피

관련 정보