的一个非常强大的功能pstricks
是其可能嵌套的rput
命令,可用于旋转和移动绘图的一部分。 中有类似的东西吗tikz
?
答案1
可以通过将内容放置在以下位置来完成scope
:
\begin{scope}[rotate=90,xshift=1cm]
...
\end{scope}
在tikzpicture
环境中scope
,环境会应用环境内容的所有本地选项。此外,如果您\usetikzlibrary{scopes}
在序言中包含 ,则可以在“某些位置”使用 开始范围,前提{
是单个括号后跟 内的选项[]
。
来自文档(v2.10 TiKZ 和 PGF 手册第 12.3 节):
左括号具有这种特殊含义的“特定位置”如下:首先,紧跟在结束路径的分号之后。其次,紧跟在范围的末尾之后。第三,紧跟在范围的开头,包括图片的开头。还要注意,后面必须有一个方括号,否则括号将被视为普通的 TeX 范围。
答案2
现在您可以使用\rput
该软件包tikzrput
(beta 版,但似乎比较稳定)。您只需tikzrput.sty
从以下位置下载这里。我需要时间来完成文档,但选项是相同的,\rput
从逻辑上讲pstricks
,您可以替换tikzrput
,然后pstricks
代码就可以编译了。
一些例子 :
仅在第一个中,对象是 tikz 图片
\documentclass{scrartcl} \PassOptionsToPackage{dvipsnames,svgnames}{xcolor} \usepackage{tikz} \usepackage{tikzrput} % from http://altermundus.com/pages/tkz/tikzrput/ \begin{document} \def\myEye{ \begin{tikzpicture} \filldraw (-0.4,1.5)--(0.7,1.8)--(0.2,2.2)--(-0.5,1.6)--cycle; \draw [clip] (0,0) circle [x radius=.8cm, y radius=1.5cm]; \fill[MidnightBlue] (0,-1) circle [radius=1cm]; \end{tikzpicture} } Tu as de beaux yeux ! \rput(8,-2){\myEye} \rput(6,-2){\reflectbox{\myEye}} \end{document}
这是文档的一部分
pstricks
\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \PassOptionsToPackage{dvipsnames,svgnames}{xcolor} \usepackage{amsmath,tikzrput,fancyvrb,booktabs,fullpage} \begin{document} \section{Placing whatever, wherever } \begin{tabular}{@{}p{\dimexpr \textwidth-6cm}@{} p{1.5cm}@{} p{4 cm}@{}} As we have already seen, the \Verb+{\rput}+ macro can be used to place objects. The second mandatory argument (in curly braces) is the stuff to place the first mandatory argument (in parenthesis) is the coordinate pair of the point where the stuff is placed. Now we turn to the optional arguments of the \Verb+{\rput}+ macro. The first one is given in brackets. It determines the justification of the bounding box of the object to place with respect to the point given in paren- thesis. The admissible values are the same as the values for the option origin of the \verb+{\includegraphics}+ macro. For an instance \Verb+{[br]}+ for bottom-right. The default is mc meaning middle - center. The second optional argument is given in curly braces just before the left parenthesis. It is a number that stands for the rotation angle as illustrated in the last instance of the \Verb+{\rput}+ macro on the slide. The two optional arguments make \Verb+{\rput}+ more exible than the \Verb+{\put}+ macro of the picture environment. & & \begin{tikzpicture}[baseline=(current bounding box.north)] \draw[help lines] (-1,0) grid (1,5) ; \foreach \x/\y in {0/5,-1/3,1/2,0.5/1} {% \rput(\x,\y ){\tikz\draw[fill=red] circle(2pt);};} \rput(0,5){Center,Middle} \rput[bl](-1,3){$\underbrace{ \text{bottom,left} }_{\text{Really!}}$} \rput[Br](1,2){$\underbrace{ \text{Baseline,right} }_{\text{Really!}}$} \rput[tr]{45}(0.5,1) {\parbox{5cm}{\flushright Rotated\\ by $45^{\circ}$}} \end{tikzpicture} \end{tabular} \end{document}
仅需 TikZ 即可构建
\rput
\documentclass{scrartcl} \usepackage{tikzrput} \begin{document} \null\vspace*{4cm}% \hspace*{5cm}% \foreach \a in {0,16,...,356}{\rput(\a;2){$\bullet$}}\rput[B](0;0){Circle}% \vspace*{4cm}% \hspace{5cm}end\rput[B](180;5cm){start} a line :\ \rput[B](5,0){end}\rput[Bl](0,0){start} \hrule \end{document}