Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\tikzstyle{...}=[...]

This command seems to be extremely useful since it allows to re-use the same style in multiple TikZ pictures.

Is is used in a few places in TikZ manual (pgfmanual.pdf), but why it is not defined or described?

What are the other useful commands not described in TikZ manual?

share|improve this question
1  
The documented command to define styles is \tikzset (see Section 11.4 of the version 2.00 manual). As a general warning: If possible never use undocumented commands. They might be dropped in later releases. –  Caramdir Aug 17 '10 at 18:45
    

2 Answers 2

The command \tikzstyle is not well documented because the author would like to encourage users to set styles locally instead. Styles should be declared

\begin{tikzpicture}[..., certain style/.style={...}, ...]
...
\en{tikzpicture}

This way the style belongs to that picture.

Perhaps read this message of the author Till Tantau: Keeping the tikzstyle command.

share|improve this answer
    
Till's message is encouraging do-repeat-yourself approach, which is strange. –  Łukasz Lew Aug 17 '10 at 18:49
    
What's the difference between tikzstyle and tikzset? –  Łukasz Lew Aug 21 '10 at 14:32
1  
@Łukasz First \tikzsetis recommended by T Tantau, and then I think \tikzset is quicker than \tikzstyle because for compatibility \tikzstyle now uses pgfkeys or \tikzset is defined by \def\tikzset{\pgfqkeys{/tikz}} . Tantau writes also \pgfqkeys is quicker. –  Alain Matthes Mar 17 '11 at 15:47
    
If \tikzstyle is used inside the environment tikzpicture, it seems to be local to this environment,no ? and it's the same for tikzset but I agree with you with the fact that T Tantau recommends to define the styles locally. –  Alain Matthes Mar 17 '11 at 15:55
    
@ŁukaszLew: Just a very late reaction to your complaint. It's possible to write \tikzset{some style/.style = ...} anywhere in the document to globally create a style; the style doesn't have to be constructed in each individual picture. So repetition is not necessary. –  Ryan Reich Nov 30 '12 at 1:36

From the beamer manual you can find that there is a macro called \pgfdeclareimage (Section 13, Graphics). This can be used to load a graphics file with a reusable name, to be applied using \pgfuseimage. This is obviously best for cases where the image is repeated in the output file (it only needs to be included once in the PDF, saving on file size). \pgfdeclareimage takes an optional argument for graphics settings, in the same way as \includegraphics.

share|improve this answer
    
oops, I just edited my answer as requested by Łukasz ... I will roll back my edit. –  Stefan Kottwitz Aug 21 '10 at 15:17
1  
I guess we must both have added to this at almost the same time, so the 'an answer has been posted' thing did not pop up. I'm guessing that one (or as here a few related) macro per answer makes most sense. –  Joseph Wright Aug 21 '10 at 15:22
    
Of course, that's why I rolled back. I edited just to avoid to post multiple answers myself. Back ontopic, here's a link to the reference of those commands from the 1.01 manual: stuff.mit.edu/afs/athena/contrib/tex-contrib/beamer/pgf-1.01/… –  Stefan Kottwitz Aug 21 '10 at 15:30
    
I notice that it basically says 'most LaTeX users of Tikz should ignore this command', to paraphrase :-) –  Joseph Wright Aug 21 '10 at 15:39
    
So, there's a reason why the current manual keeps those commands 'secret'. –  Stefan Kottwitz Aug 21 '10 at 15:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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