2

try to get pgf manuals title page code into own areas. I have copied the code snippet of titlepage for nodeshadowed, but get error: \nodeshadowed has an extra }. I don't see the error. Additionally it seems I have troubles to put the code right in here (following mwe). But I try anyway. Thanks for your ideas.

    \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
    Have you defined \mybox? – Sebastiano Dec 9 '18 at 16:17
  • No, i have thought it was defined by/in first node (newbie). Insert of \newsavebox\mybox leads to same error. – gizeh Dec 10 '18 at 16:32
3

I do not know why you are doing all the \mybox stuff. If you want to do it, you may want, as suggested by @Sebastiano, define it, i.e. do \newsavebox\mybox. But I don't see what this will be good for.

\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}

enter image description here

  • code is at least original code from pgf-manual 301a i have met many problems to realize the code in an own area. i wanted to use the same code as on title. the nodeshadowed was unsolvable for me. So many thanks for your solution. Code of manual seems to include many pitfalls. – gizeh Dec 10 '18 at 16:28
  • @gizeh The manual is great except that one never really knows with libraries are to be loaded. – marmot Dec 10 '18 at 16:30
  • your code solves the problem, but is not able to set the lindenmayer fadings correctly. Origins of the "plants" doesn't suit, Slightly shifted. With Tantau's corrected code of nodeshadowed it works. – gizeh Dec 22 '18 at 11:08
0

Two corrections for mwe.

1) Declare mybox (\newbox\mybox). Thanks @Sebastiano Corr.1

2) Consider the syntax of \def in Tikz. See below Corr.2

So it works for me compiling with pdflatex. Unfortunately I don't know how to include the resulting pdf here.

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.