尝试将 pgf 手册标题页代码放入自己的区域。我已复制了 nodeshadowed 的标题页代码片段,但出现错误:\nodeshadowed 有一个额外的 }。我没有看到错误。此外,我似乎很难将代码放在这里(在 mwe 之后)。但我还是尝试了。感谢您的想法。
\documentclass[fontsize=10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[margin=1cm,a5paper]{geometry}
\usepackage{tikz}
\usetikzlibrary{fadings}
\usepackage[ngerman]{babel}
\begin{document}
\parbox[]{\textwidth}{%
\begin{tikzpicture}[]
\def\nodeshadowed[#1][#2]{
\node[scale=2,above,#1]{\global\setbox\mybox=\hbox{#2}\copy\mybox};
\node[scale=2,above,#1,yscale=-1,scope fading=south,opacity=0.4] {\box\mybox};
}
\nodeshadowed [at={(-4,4 )},yslant=0.05] {\Huge Meli};
\end{tikzpicture}
}%end parbox
\end{document}
答案1
我不知道你为什么要做所有这些\mybox
事情。如果你想这样做,你可能想要按照@Sebastiano的建议定义它,即 do \newsavebox\mybox
。但我不明白这有什么用。
\documentclass[fontsize=10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[margin=1cm,a5paper]{geometry}
\usepackage{tikz}
\usetikzlibrary{fadings}
\newcommand{\nodeshadowed}[2][]{
\node[scale=2,above,#1]{#2};
\node[scale=2,above,#1,yscale=-1,scope fading=south,opacity=0.4]
{#2};
}
\begin{document}
\parbox[]{\textwidth}{%
\begin{tikzpicture}[]
\nodeshadowed[at={(-4,4 )},yslant=0.05]{\Huge Meli};
\end{tikzpicture}
}%end parbox
\end{document}
答案2
对 mwe 进行两处修正。
1) 声明 mybox (\newbox\mybox)。感谢@Sebastiano Corr.1
2) 考虑 Tikz 中 \def 的语法。见下文 Corr.2
所以它对我来说可以用 pdflatex 编译。不幸的是,我不知道如何在此处包含生成的 pdf。
\documentclass[fontsize=10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[margin=1cm,a5paper]{geometry}
\usepackage[a5,frame,center]{crop}
\usepackage{tikz}
\usetikzlibrary{fadings,lindenmayersystems}
\usepackage[ngerman]{babel}
\begin{document}
\centering
\newbox\mybox %necessary for use in following def. Corr.1
\parbox[]{\textwidth}{%
\begin{tikzpicture}[]
\def\nodeshadowed[#1]#2;{%syntax error in first mwe, corrected. [ and ] and ; are part of def!
%cmp. pgf man. 301a p.82 for a def - example. Corr.2
\node[scale=2,above,#1]{\global\setbox\mybox=\hbox{#2}\copy\mybox};
\node[scale=2,above,#1,yscale=-1,scope fading=south,opacity=0.4] {\box\mybox};
}%end of \def needs no ";".
\draw[step=.5cm,help lines] (-6,-5.5) grid (6,5.5);
\foreach \x in {-6,...,6}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\x$};
\foreach \y in {-5.5,...,5.5}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east] {$\y$};
\draw (1pt,0 cm) -- (-1pt,0 cm) node[anchor=east] {};
\foreach \where in {-3.5cm,3.5cm} {%
\nodeshadowed [at={(\where,0cm)}]
{ \tikz
\draw [green!20!black,
rotate=90,
l-system={rule set={F -> FF-[-F+F]+[+F-F]},
axiom=F,
order=4,%sets the number of iterations the L-System will perform 301a p.638
step=1pt,
randomize step percent=50,
angle=30,
randomize angle percent=5}
]
l-system;
};%end nodeshadowed
}%end foreach
\nodeshadowed [at={(-5,3 )},yslant=0.05] {\huge Meli};%{ and } contains the two params defined above
\nodeshadowed [at={( 0,3.3)}]{\huge \textcolor{green!50!black!50}{\&}};
\nodeshadowed [at={( 5,3 )},yslant=-0.05] {\huge Imo};
\end{tikzpicture}
}%end parbox
\end{document}