From claude.quitte at orange.fr Fri Aug 9 07:55:45 2024 From: claude.quitte at orange.fr (Claude Quitte) Date: Fri, 9 Aug 2024 07:55:45 +0200 Subject: [pgf-tikz] Style with two "parameters" : problem with arguments Message-ID: <1310d660-47d0-3cb4-53c1-64cb91e33f1c@orange.fr> Hello I attach a small LaTeX source using tikz and the pdf produced. 1. Context : \usepackage{tikz} \usetikzlibrary{decorations.markings} \tikzset{->-/.style 2 args = {decoration={markings, mark=at position{#1} with {\arrow#2}}, postaction=decorate}} 2. No problem with : \draw [->- = {0.6} {latex}] (0,0) -- (1,0) ; \draw [->- = {0.6}{{latex}}] (2,0) -- (3,0) ; 3. But, if no space between arguments, a problem with \draw [->- = {0.6}{latex}] (4,0) -- (5,0) ; %% \draw [->- = {0.6}{latex}] (4,0) -- (5,0) ; %% ! Package pgf Error: Unknown arrow tip kind 'l'. %% See the pgf package documentation for explanation. %% Type H for immediate help. %% ... %% l.17 \draw [->- = {0.6}{latex}] (4,0) -- (5,0) ; 4. No problem with \draw [->-= {0.6}{[ultra thick]{>}}] (6,0) -- (7,0) ; 5. But, if a space between arguments, a problem with \draw [->-= {0.6} {[ultra thick]{>}}] (8,0) -- (9,0) ; %% \draw [->-= {0.6} {[ultra thick]{>}}] (8,0) -- (9,0) ; %% ! Package pgfkeys Error: I do not know the key 'ultra thick' and I am going to %% ignore it. Perhaps you misspelled it. %% %% See the pgfkeys package documentation for explanation. %% Type H for immediate help. %% ... %% l.28 ...{0.6} {[ultra thick]{>}}] (8,0) -- (9,0) ; THANKS for an answer. Claude Quitte (France) -------------- next part -------------- A non-text attachment was scrubbed... Name: ArgumentsProbem.tex Type: application/x-tex Size: 1337 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ArgumentsProbem.pdf Type: application/pdf Size: 38364 bytes Desc: not available URL: From muzimuzhi at gmail.com Fri Aug 9 16:01:38 2024 From: muzimuzhi at gmail.com (Yukai Chou) Date: Fri, 9 Aug 2024 22:01:38 +0800 Subject: [pgf-tikz] Style with two "parameters" : problem with arguments In-Reply-To: References: Message-ID: Hi Claude, Unfortunately, what you encountered, though perhaps puzzling, was "worked as expected". Similar to the key handler /.code 2 args={}, handler /.style 2 args={} stores the `` in an internal macro, whose parameter always ends with \pgfeov \def\some at internal@macro#1#2\pgfeov{} That \pgfeov makes the #2 delimited. Combining with the space trimming behavior of key-value processing done by pgfkeys package, - In "->- = {0.6} {latex}", #1 <- "0.6" and #2 <- " {latex}" (note the leading space), which leads to "decoration={markings, mark=at position{0.6} with {\arrow {latex}}" thus works. - In "->- = {0.6}{{latex}}", #2 <- "{latex}", which leads to "...\arrow{latex}..." thus also works. - In "->- = {0.6}{latex}", #2 <- "latex", which leads to something equivalent to "...\arrow latex" thus errors. - In "->-= {0.6}{[ultra thick]{>}}", #2 <- "[ultra thick]{>}", which leads to "...\arrow[ultra thick]{>}..." thus again works. - In "->-= {0.6} {[ultra thick]{>}}", #2 <- " {[ultra thick]{>}" (again the leading space), which leads to "... \arrow {[ultra thick]{>}" thus errors. Handler /.style n args={}{} doesn't delimit the parameter text, thus can give a more consistent behavior, of which the space(s) between arguments are always skipped (just like the macros defined by \newcommand[]\cmd{}.) \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings} \tikzset{->-/.style n args = {2}{decoration={markings, mark=at position{#1} with {\arrow#2}}, postaction=decorate}} \begin{document} \begin {tikzpicture} \draw [->- = {0.6} {latex}] (0,0) -- (1,0) ; % errors \draw [->- = {0.6}{{latex}}] (2,0) -- (3,0) ; \draw [->- = {0.6}{latex}] (4,0) -- (5,0) ; % errors \draw [->-= {0.6}{[ultra thick]{>}}] (6,0) -- (7,0) ; \draw [->-= {0.6} {[ultra thick]{>}}] (8,0) -- (9,0) ; \end {tikzpicture} \end{document} Similar discussions - https://github.com/pgf-tikz/pgf/issues/1201 - https://github.com/pgf-tikz/pgf/issues/1350 best regards, Yukai Chou ?2024?8?9??? 20:55??? > > Send pgf-tikz mailing list submissions to > pgf-tikz at tug.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://tug.org/mailman/listinfo/pgf-tikz > or, via email, send a message with subject or body 'help' to > pgf-tikz-request at tug.org > > You can reach the person managing the list at > pgf-tikz-owner at tug.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of pgf-tikz digest..." > > > Today's Topics: > > 1. Style with two "parameters" : problem with arguments > (Claude Quitte) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 9 Aug 2024 07:55:45 +0200 > From: Claude Quitte > To: pgf-tikz at tug.org > Subject: [pgf-tikz] Style with two "parameters" : problem with > arguments > Message-ID: <1310d660-47d0-3cb4-53c1-64cb91e33f1c at orange.fr> > Content-Type: text/plain; charset="utf-8"; Format="flowed" > > Hello > > I attach a small LaTeX source using tikz and the pdf produced. > > 1. Context : > > \usepackage{tikz} > \usetikzlibrary{decorations.markings} > > \tikzset{->-/.style 2 args = {decoration={markings, mark=at position{#1} > with {\arrow#2}}, > postaction=decorate}} > > 2. No problem with : > > \draw [->- = {0.6} {latex}] (0,0) -- (1,0) ; > \draw [->- = {0.6}{{latex}}] (2,0) -- (3,0) ; > > 3. But, if no space between arguments, a problem with \draw [->- = > {0.6}{latex}] (4,0) -- (5,0) ; > %% \draw [->- = {0.6}{latex}] (4,0) -- (5,0) ; > %% ! Package pgf Error: Unknown arrow tip kind 'l'. > %% See the pgf package documentation for explanation. > %% Type H for immediate help. > %% ... > %% l.17 \draw [->- = {0.6}{latex}] (4,0) -- (5,0) ; > > > 4. No problem with > > \draw [->-= {0.6}{[ultra thick]{>}}] (6,0) -- (7,0) ; > > 5. But, if a space between arguments, a problem with \draw [->-= {0.6} > {[ultra thick]{>}}] (8,0) -- (9,0) ; > > %% \draw [->-= {0.6} {[ultra thick]{>}}] (8,0) -- (9,0) ; > %% ! Package pgfkeys Error: I do not know the key 'ultra thick' and I am > going to > %% ignore it. Perhaps you misspelled it. > %% > %% See the pgfkeys package documentation for explanation. > %% Type H for immediate help. > %% ... > %% l.28 ...{0.6} {[ultra thick]{>}}] (8,0) -- (9,0) ; > > > THANKS for an answer. > > Claude Quitte (France) > > > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: ArgumentsProbem.tex > Type: application/x-tex > Size: 1337 bytes > Desc: not available > URL: > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: ArgumentsProbem.pdf > Type: application/pdf > Size: 38364 bytes > Desc: not available > URL: > > End of pgf-tikz Digest, Vol 29, Issue 1 > *************************************** From claude.quitte at orange.fr Fri Aug 9 18:27:58 2024 From: claude.quitte at orange.fr (Claude Quitte) Date: Fri, 9 Aug 2024 18:27:58 +0200 Subject: [pgf-tikz] Style with two "parameters" : problem with arguments In-Reply-To: References: Message-ID: <408d6bf3-5008-7e96-c5e0-fd6b1730db4b@orange.fr> Dear Yukai Chou Thanks for your detailled answer. These are my first steps with tikz-pgf and I was ignorant of \pgfkeys mechanism. Best regards Claude Quitte