我正在尝试将某些对象放置在我的页面上。通常,您可以使用参数shift
将对象放置在一组坐标上,甚至current page
。对于以下一段代码,这些似乎都不起作用:
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[usenames,dvipsnames]{color}
\usepackage{tikz}
\usetikzlibrary{fadings,shapes.arrows,curvilinear,shadings}
\usepgfmodule{nonlineartransformations}
\pagenumbering{gobble}
\definecolor{lightblue}{RGB}{51,127,230}
\definecolor{olive2}{RGB}{64,196,0}
\definecolor{dorange}{RGB}{255,140,0}
\tikzfading[name=arrowfading, left color=transparent!0, right color=transparent!35]
\tikzset{
arrownode/.style={
transform shape nonlinear=true,
shape=double arrow,
line width=10mm,
shape border rotate=180,
upper left=cyan!25,
lower left=dorange!5,
upper right=olive!35,
lower right=dorange!20,
path fading=arrowfading
}
}
\makeatletter
\def\polartransformation{% I'll probably need another transformation? I can't find anything in the PGF manual on using a third variable
\pgfmathsincos@{\pgf@x}
\pgf@x=\pgfmathresultx\pgf@y%
\pgf@y=\pgfmathresulty\pgf@y%
}
\makeatother
\begin{document}
\centering
\begin{tikzpicture}
\begin{scope}[remember picture,overlay]% I want to use shift={<argument>} here in CARTESIAN COORDINATES.
\pgftransformnonlinear{\polartransformation}
%%%%%%%%%%%%%% Draw the node
\node[arrownode,shading angle=0] (a) at (1.5*pi,-5) {\phantom{\hspace{2cm}Gleidende schaal\hspace{4cm}}};
\end{scope}
\end{tikzpicture}
\end{document}
我怎样才能让这个东西到达例如(-5,-5)?
答案1
我修改了我的解决方案,使用以下方法有哪些方法可以将内容绝对定位在页面上?通过指定绝对纸张坐标来放置对象。我将对象放置为“水印”,但我不清楚这是否是您想要的,或者它是否可以满足您的需求。
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[usenames,dvipsnames]{color}
\usepackage{tikz}
\usetikzlibrary{fadings,shapes.arrows,curvilinear,shadings}
\usepgfmodule{nonlineartransformations}
\pagenumbering{gobble}
\definecolor{lightblue}{RGB}{51,127,230}
\definecolor{olive2}{RGB}{64,196,0}
\definecolor{dorange}{RGB}{255,140,0}
\tikzfading[name=arrowfading, left color=transparent!0, right color=transparent!35]
\tikzset{
arrownode/.style={
transform shape nonlinear=true,
shape=double arrow,
line width=10mm,
shape border rotate=180,
upper left=cyan!25,
lower left=dorange!5,
upper right=olive!35,
lower right=dorange!20,
path fading=arrowfading
}
}
\makeatletter
\def\polartransformation{% I'll probably need another transformation? I can't find anything in the PGF manual on using a third variable
\pgfmathsincos@{\pgf@x}
\pgf@x=\pgfmathresultx\pgf@y%
\pgf@y=\pgfmathresulty\pgf@y%
}
\makeatother
\usepackage{lipsum}
\usepackage{everypage}
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
\AddThispageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{\textcolor{red}{#3}}}}}
\begin{document}
\lipsum[1]
\atxy{4.25in}{5.5in}{%SHIFT IS ACCOMPLISHED HERE IN CARTESIAN (PAPER COORDINATES)
\begin{tikzpicture}
\begin{scope}[remember picture,overlay]% I want to use shift={<argument>} here in CARTESIAN COORDINATES.
\pgftransformnonlinear{\polartransformation}
%%%%%%%%%%%%%% Draw the node
\node[arrownode,shading angle=0] (a) at (1.5*pi,-5) {\phantom{\hspace{2cm}Gleidende schaal\hspace{4cm}}};
\end{scope}
\end{tikzpicture}%
}
\lipsum[2]
\end{document}
如果不想将其作为水印效果,则正确使用\vspace
或其他一些空格跳过机制(例如,紧接着之前\lipsum[2]
)将允许将图形隔离:
答案2
经过一番摆弄和询问后,我得到了以下答案:在 tikz-pgf 中,可以将节点嵌入到另一个节点中:
\draw (0,0) node {\begin{tikzpicture}
\begin{scope}[remember picture,overlay] \pgftransformnonlinear{\polartransformation}
\node[arrownode,shading angle=0] (a) at (1.5*pi,-5) {\phantom{\hspace{2cm}Gleidende schaal\hspace{4cm}}};
\path[decorate,decoration={text along path,text format delimiters={[}{]},
text={[\Huge]GLEIDENDE SCHAAL},
text align={fit to path},
raise=-2ex,
}](a.west) -- (a.east);
\end{scope}
\end{tikzpicture}};
这也允许您在同一张图片中引用该节点。