![tikz 中旋转文本节点时如何修复定位?](https://linux22.com/image/405002/tikz%20%E4%B8%AD%E6%97%8B%E8%BD%AC%E6%96%87%E6%9C%AC%E8%8A%82%E7%82%B9%E6%97%B6%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%E5%AE%9A%E4%BD%8D%EF%BC%9F.png)
% 当我尝试旋转节点时,它会跳转到第二页。我该如何修复这个问题?
\documentclass[20pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{paperheight=61.1cm,paperwidth=61.1cm,margin=5mm}
\usepackage{tikz, pgfornament, tikzrput}
\usetikzlibrary{shapes,positioning,decorations.markings}
\usetikzlibrary{decorations.text}
\usepackage{bookman}
\usepackage{graphicx}
\usepackage{pdfrender}
\usepackage{pdfpages}
\makeatletter
\makeatother
\begin{document}
\centering
{
\begin{tikzpicture}
\newcommand{\titlebox}[1]{%
\begin{center}
\begin{scope}
\node[align=center,draw,thick,text width=0.4\textwidth,inner sep=10mm,
yshift=85mm] (titlebox)%
{\textsc{}\\[\baselineskip]\textbf{\huge #1}};\\
\node[fill=white] (W) at (titlebox.north) {\bfseries \Huge ISOAP};
\end{scope}
\end{center}
}
\titlebox{\textsc{\Large{Rose Clear Hand Soap}}} % An example use
\node (example-textwidth-2) [text width=53.2cm, font=\fontsize{45pt}
{45pt}\selectfont,
align=justify] at (0.4,-6) {%
{\textbf{INGREDIENTS:} }
};
\node (example-textwidth-2) [text width=53cm, font=\fontsize{45pt}
{45pt}\selectfont, align=justify] at (0.4,-13) {%
{\textbf{CAUTION:} }
};
\node (example-textwidth-2) [text width=53cm, font=\fontsize{27pt}
{27pt}\selectfont, align=center, rotate=90] at (-20,-25) {%
{{}MFG date: 10/10/19}
};
\node (example-textwidth-2) [text width=53cm, font=\fontsize{27pt}
{27pt}\selectfont, align=center, rotate=90] at (-18,-25) {%
{{}EXP date: 10/2021}
};
\node (example-textwidth-2) [text width=53cm, font=\fontsize{27pt}
{27pt}\selectfont, align=center, rotate=-90] at (18,-24) {%
{{}Lot No 091091}
};
\end{tikzpicture}
}
\end{document}
答案1
问题是,您旋转的节点的文本宽度过大text width=53cm
。如果您旋转它们,垂直尺寸会tikzpicture
变得太大,图片会移动到下一页。如果您修复它,问题就消失了。
\documentclass[20pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{paperheight=61.1cm,paperwidth=61.1cm,margin=5mm}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{bookman}
\usepackage{pdfrender}
\usepackage{pdfpages}
\begin{document}
\centering
{
\begin{tikzpicture}
\newcommand{\titlebox}[1]{%
\begin{scope}
\node[align=center,draw,thick,text width=0.4\textwidth,inner sep=10mm,
yshift=85mm] (titlebox)%
{\textsc{}\\[\baselineskip]\textbf{\huge #1}};
\node[fill=white] (W) at (titlebox.north) {\bfseries \Huge ISOAP};
\end{scope}}
\titlebox{\textsc{\Large{Rose Clear Hand Soap}}} % An example use
\node (example-textwidth-2) [text width=53.2cm, font=\fontsize{45pt}
{45pt}\selectfont,
align=justify] at (0.4,-6) {%
{\textbf{INGREDIENTS:} }
};
\node (example-textwidth-2) [text width=53cm, font=\fontsize{45pt}
{45pt}\selectfont, align=justify] at (0.4,-13) {%
{\textbf{CAUTION:} }
};
\node (example-textwidth-2) [text width=5cm, font=\fontsize{27pt}
{27pt}\selectfont, align=center, rotate=90] at (-20,-25) {%
{{}MFG date: 10/10/19}
};
\node (example-textwidth-2) [text width=5cm, font=\fontsize{27pt}
{27pt}\selectfont, align=center, rotate=90] at (-18,-25) {%
{{}EXP date: 10/2021}
};
\node (example-textwidth-2) [text width=5cm, font=\fontsize{27pt}
{27pt}\selectfont, align=center, rotate=-90] at (18,-24) {%
{{}Lot No 091091}
};
\end{tikzpicture}
}
\end{document}
请注意在tikzpicture
环境中center
没有发挥应有的效果,而你却拥有了\\
不该拥有的东西。