Where is my understanding of TikZ styles wrong?Document compiling in online editor but not in TeXworks?How can I put a coloured outline around fraction lines?Tikz Polar GridNumerical conditional within tikz keys?polar chart heat mapTikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Drawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?Drawing a Grid/Tikz image

Fix /dev/sdb after using dd with no device inserted

Why would guns not work in the dungeon?

School House Points (Python + SQLite)

Mbed Cortex-m hardfault when sending data via TCP

Why hasn't the U.S. government paid war reparations to any country it attacked?

A "Simple" Task

Help with understanding nuances of extremely popular Kyoto-ben (?) tweet

Can you negate disadvantage on throwing a net by using the Lunging Attack maneuver of the Battle Master fighter?

Optimising Table wrapping over a Select

Filtering fine silt/mud from water (not necessarily bacteria etc.)

Supporting developers who insist on using their pet language

What is temperature on a quantum level?

Are there any double stars that I can actually see orbit each other?

Extract an attribute value from XML

Password maker in C#

Why limit to revolvers?

Occasus nescius

How can an advanced civilization forget how to manufacture its technology?

Is `curl something | sudo bash -` a reasonably safe installation method?

Find the wrong number in the given series: 6, 12, 21, 36, 56, 81?

Conciousness in Buddhism and Advaita Vedanta

Can I intentionally omit previous work experience or pretend it doesn't exist when applying for jobs?

How to convert 1k to 1000 and 1m to 1000000 in Excel

Is this floating-point optimization allowed?



Where is my understanding of TikZ styles wrong?


Document compiling in online editor but not in TeXworks?How can I put a coloured outline around fraction lines?Tikz Polar GridNumerical conditional within tikz keys?polar chart heat mapTikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Drawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?Drawing a Grid/Tikz image






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I am trying to learn TikZ by reading the manual (p.34). I know my understanding must be completely off the rails, since nothing is working as I think I should; but I'm not sure what I misunderstood.



What I understood from the manual is this: let's say that you want to draw many circles of the form



draw[red, very thick, radius = 1] (0, 0) circle;


Instead of writing red, very thick, radius = 1, you could pack all of this into just one word, via TikZ style, like so



myCircle/.style = red, very thick, radius = 1;



and now you are able to draw circles faster, since you can just write



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture

`myCircle/.style = red, very thick, radius = 1;`
draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;

endtikzpicture

enddocument


However, this does not work; it does not even compile.



This is perhaps even more confusing (for me): in the manual, they do something similar with help lines, which apparently is a predefined thing (a style?) in the TikZ package. Now the following does compile, but it does not work to make the grid lines blue and very thick.



documentclassbook
usepackagetikz
usepackageparskip
begindocument

begintikzpicture

help lines/. style = blue, very thick
draw[help lines] (-4, -4) grid (4, 4);

endtikzpicture

enddocument


Could you please help me see where my understanding is wrong? Thanks.










share|improve this question

















  • 1





    Your style definition should be in a tikzset command.

    – Ulrike Fischer
    8 hours ago











  • @UlrikeFischer And that goes outside of the TikZ picture environment, right? But then what is the point of the style definition inside the TikZ environment? Is it only used to modify styles that were already defined outside of the TikZ environment?

    – Ovi
    8 hours ago











  • @UlrikeFischer I tried putting the line tikzset myCircle/. style = blue, very thick, radius = 1 before my TikZ environment and then I put draw[myCircle] (-4, -4) circle; in my TikZ environment, but it did not work.

    – Ovi
    8 hours ago






  • 3





    As @UlrikeFischer is saying, it should be a style definition. You only need to add [...] around them: begintikzpicture[myCircle/.style = red, very thick, radius = 1] and begintikzpicture[help lines/. style = blue, very thick]. The examples in the pgfmanual do have these brackets.

    – marmot
    8 hours ago


















3















I am trying to learn TikZ by reading the manual (p.34). I know my understanding must be completely off the rails, since nothing is working as I think I should; but I'm not sure what I misunderstood.



What I understood from the manual is this: let's say that you want to draw many circles of the form



draw[red, very thick, radius = 1] (0, 0) circle;


Instead of writing red, very thick, radius = 1, you could pack all of this into just one word, via TikZ style, like so



myCircle/.style = red, very thick, radius = 1;



and now you are able to draw circles faster, since you can just write



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture

`myCircle/.style = red, very thick, radius = 1;`
draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;

endtikzpicture

enddocument


However, this does not work; it does not even compile.



This is perhaps even more confusing (for me): in the manual, they do something similar with help lines, which apparently is a predefined thing (a style?) in the TikZ package. Now the following does compile, but it does not work to make the grid lines blue and very thick.



documentclassbook
usepackagetikz
usepackageparskip
begindocument

begintikzpicture

help lines/. style = blue, very thick
draw[help lines] (-4, -4) grid (4, 4);

endtikzpicture

enddocument


Could you please help me see where my understanding is wrong? Thanks.










share|improve this question

















  • 1





    Your style definition should be in a tikzset command.

    – Ulrike Fischer
    8 hours ago











  • @UlrikeFischer And that goes outside of the TikZ picture environment, right? But then what is the point of the style definition inside the TikZ environment? Is it only used to modify styles that were already defined outside of the TikZ environment?

    – Ovi
    8 hours ago











  • @UlrikeFischer I tried putting the line tikzset myCircle/. style = blue, very thick, radius = 1 before my TikZ environment and then I put draw[myCircle] (-4, -4) circle; in my TikZ environment, but it did not work.

    – Ovi
    8 hours ago






  • 3





    As @UlrikeFischer is saying, it should be a style definition. You only need to add [...] around them: begintikzpicture[myCircle/.style = red, very thick, radius = 1] and begintikzpicture[help lines/. style = blue, very thick]. The examples in the pgfmanual do have these brackets.

    – marmot
    8 hours ago














3












3








3








I am trying to learn TikZ by reading the manual (p.34). I know my understanding must be completely off the rails, since nothing is working as I think I should; but I'm not sure what I misunderstood.



What I understood from the manual is this: let's say that you want to draw many circles of the form



draw[red, very thick, radius = 1] (0, 0) circle;


Instead of writing red, very thick, radius = 1, you could pack all of this into just one word, via TikZ style, like so



myCircle/.style = red, very thick, radius = 1;



and now you are able to draw circles faster, since you can just write



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture

`myCircle/.style = red, very thick, radius = 1;`
draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;

endtikzpicture

enddocument


However, this does not work; it does not even compile.



This is perhaps even more confusing (for me): in the manual, they do something similar with help lines, which apparently is a predefined thing (a style?) in the TikZ package. Now the following does compile, but it does not work to make the grid lines blue and very thick.



documentclassbook
usepackagetikz
usepackageparskip
begindocument

begintikzpicture

help lines/. style = blue, very thick
draw[help lines] (-4, -4) grid (4, 4);

endtikzpicture

enddocument


Could you please help me see where my understanding is wrong? Thanks.










share|improve this question














I am trying to learn TikZ by reading the manual (p.34). I know my understanding must be completely off the rails, since nothing is working as I think I should; but I'm not sure what I misunderstood.



What I understood from the manual is this: let's say that you want to draw many circles of the form



draw[red, very thick, radius = 1] (0, 0) circle;


Instead of writing red, very thick, radius = 1, you could pack all of this into just one word, via TikZ style, like so



myCircle/.style = red, very thick, radius = 1;



and now you are able to draw circles faster, since you can just write



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture

`myCircle/.style = red, very thick, radius = 1;`
draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;

endtikzpicture

enddocument


However, this does not work; it does not even compile.



This is perhaps even more confusing (for me): in the manual, they do something similar with help lines, which apparently is a predefined thing (a style?) in the TikZ package. Now the following does compile, but it does not work to make the grid lines blue and very thick.



documentclassbook
usepackagetikz
usepackageparskip
begindocument

begintikzpicture

help lines/. style = blue, very thick
draw[help lines] (-4, -4) grid (4, 4);

endtikzpicture

enddocument


Could you please help me see where my understanding is wrong? Thanks.







tikz-pgf tikz-styles






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









OviOvi

2491 silver badge7 bronze badges




2491 silver badge7 bronze badges







  • 1





    Your style definition should be in a tikzset command.

    – Ulrike Fischer
    8 hours ago











  • @UlrikeFischer And that goes outside of the TikZ picture environment, right? But then what is the point of the style definition inside the TikZ environment? Is it only used to modify styles that were already defined outside of the TikZ environment?

    – Ovi
    8 hours ago











  • @UlrikeFischer I tried putting the line tikzset myCircle/. style = blue, very thick, radius = 1 before my TikZ environment and then I put draw[myCircle] (-4, -4) circle; in my TikZ environment, but it did not work.

    – Ovi
    8 hours ago






  • 3





    As @UlrikeFischer is saying, it should be a style definition. You only need to add [...] around them: begintikzpicture[myCircle/.style = red, very thick, radius = 1] and begintikzpicture[help lines/. style = blue, very thick]. The examples in the pgfmanual do have these brackets.

    – marmot
    8 hours ago













  • 1





    Your style definition should be in a tikzset command.

    – Ulrike Fischer
    8 hours ago











  • @UlrikeFischer And that goes outside of the TikZ picture environment, right? But then what is the point of the style definition inside the TikZ environment? Is it only used to modify styles that were already defined outside of the TikZ environment?

    – Ovi
    8 hours ago











  • @UlrikeFischer I tried putting the line tikzset myCircle/. style = blue, very thick, radius = 1 before my TikZ environment and then I put draw[myCircle] (-4, -4) circle; in my TikZ environment, but it did not work.

    – Ovi
    8 hours ago






  • 3





    As @UlrikeFischer is saying, it should be a style definition. You only need to add [...] around them: begintikzpicture[myCircle/.style = red, very thick, radius = 1] and begintikzpicture[help lines/. style = blue, very thick]. The examples in the pgfmanual do have these brackets.

    – marmot
    8 hours ago








1




1





Your style definition should be in a tikzset command.

– Ulrike Fischer
8 hours ago





Your style definition should be in a tikzset command.

– Ulrike Fischer
8 hours ago













@UlrikeFischer And that goes outside of the TikZ picture environment, right? But then what is the point of the style definition inside the TikZ environment? Is it only used to modify styles that were already defined outside of the TikZ environment?

– Ovi
8 hours ago





@UlrikeFischer And that goes outside of the TikZ picture environment, right? But then what is the point of the style definition inside the TikZ environment? Is it only used to modify styles that were already defined outside of the TikZ environment?

– Ovi
8 hours ago













@UlrikeFischer I tried putting the line tikzset myCircle/. style = blue, very thick, radius = 1 before my TikZ environment and then I put draw[myCircle] (-4, -4) circle; in my TikZ environment, but it did not work.

– Ovi
8 hours ago





@UlrikeFischer I tried putting the line tikzset myCircle/. style = blue, very thick, radius = 1 before my TikZ environment and then I put draw[myCircle] (-4, -4) circle; in my TikZ environment, but it did not work.

– Ovi
8 hours ago




3




3





As @UlrikeFischer is saying, it should be a style definition. You only need to add [...] around them: begintikzpicture[myCircle/.style = red, very thick, radius = 1] and begintikzpicture[help lines/. style = blue, very thick]. The examples in the pgfmanual do have these brackets.

– marmot
8 hours ago






As @UlrikeFischer is saying, it should be a style definition. You only need to add [...] around them: begintikzpicture[myCircle/.style = red, very thick, radius = 1] and begintikzpicture[help lines/. style = blue, very thick]. The examples in the pgfmanual do have these brackets.

– marmot
8 hours ago











1 Answer
1






active

oldest

votes


















5














You have a couple (4?) of problems.



  1. if you want to define the style for one picture, you need to put it into the optional argument of the picture, in square brackets [ ];

  2. The style is terminated by , (or the end of the argument), not ;

  3. In a tikzset, the style has the scope determined by the normal TeX rules.

  4. You can't have a space between the / and the .style handler.

This works:



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture[
myCircle/.style = red, very thick, radius = 1, % end with a comma, NOT semicolon!
]

draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;
endtikzpicture

tikzsethelp lines/.style = blue, very thick %% no spaces between / and .style!

begintikzpicture
draw[help lines] (-4, -4) grid (4, 4);
endtikzpicture

enddocument


enter image description here






share|improve this answer

























  • Thanks for the example! I wasn't able to fix it just based on the comments alone.

    – Ovi
    7 hours ago






  • 5





    It is often easier to show than explain.

    – John Kormylo
    7 hours ago













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f499776%2fwhere-is-my-understanding-of-tikz-styles-wrong%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














You have a couple (4?) of problems.



  1. if you want to define the style for one picture, you need to put it into the optional argument of the picture, in square brackets [ ];

  2. The style is terminated by , (or the end of the argument), not ;

  3. In a tikzset, the style has the scope determined by the normal TeX rules.

  4. You can't have a space between the / and the .style handler.

This works:



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture[
myCircle/.style = red, very thick, radius = 1, % end with a comma, NOT semicolon!
]

draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;
endtikzpicture

tikzsethelp lines/.style = blue, very thick %% no spaces between / and .style!

begintikzpicture
draw[help lines] (-4, -4) grid (4, 4);
endtikzpicture

enddocument


enter image description here






share|improve this answer

























  • Thanks for the example! I wasn't able to fix it just based on the comments alone.

    – Ovi
    7 hours ago






  • 5





    It is often easier to show than explain.

    – John Kormylo
    7 hours ago















5














You have a couple (4?) of problems.



  1. if you want to define the style for one picture, you need to put it into the optional argument of the picture, in square brackets [ ];

  2. The style is terminated by , (or the end of the argument), not ;

  3. In a tikzset, the style has the scope determined by the normal TeX rules.

  4. You can't have a space between the / and the .style handler.

This works:



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture[
myCircle/.style = red, very thick, radius = 1, % end with a comma, NOT semicolon!
]

draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;
endtikzpicture

tikzsethelp lines/.style = blue, very thick %% no spaces between / and .style!

begintikzpicture
draw[help lines] (-4, -4) grid (4, 4);
endtikzpicture

enddocument


enter image description here






share|improve this answer

























  • Thanks for the example! I wasn't able to fix it just based on the comments alone.

    – Ovi
    7 hours ago






  • 5





    It is often easier to show than explain.

    – John Kormylo
    7 hours ago













5












5








5







You have a couple (4?) of problems.



  1. if you want to define the style for one picture, you need to put it into the optional argument of the picture, in square brackets [ ];

  2. The style is terminated by , (or the end of the argument), not ;

  3. In a tikzset, the style has the scope determined by the normal TeX rules.

  4. You can't have a space between the / and the .style handler.

This works:



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture[
myCircle/.style = red, very thick, radius = 1, % end with a comma, NOT semicolon!
]

draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;
endtikzpicture

tikzsethelp lines/.style = blue, very thick %% no spaces between / and .style!

begintikzpicture
draw[help lines] (-4, -4) grid (4, 4);
endtikzpicture

enddocument


enter image description here






share|improve this answer















You have a couple (4?) of problems.



  1. if you want to define the style for one picture, you need to put it into the optional argument of the picture, in square brackets [ ];

  2. The style is terminated by , (or the end of the argument), not ;

  3. In a tikzset, the style has the scope determined by the normal TeX rules.

  4. You can't have a space between the / and the .style handler.

This works:



documentclassbook
usepackagetikz
usepackageparskip

begindocument

begintikzpicture[
myCircle/.style = red, very thick, radius = 1, % end with a comma, NOT semicolon!
]

draw[myCircle] (0, 0) circle;
draw[myCircle] (1, 2) circle;
draw[myCircle] (3, 4) circle;
endtikzpicture

tikzsethelp lines/.style = blue, very thick %% no spaces between / and .style!

begintikzpicture
draw[help lines] (-4, -4) grid (4, 4);
endtikzpicture

enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 7 hours ago

























answered 7 hours ago









RmanoRmano

9,5582 gold badges17 silver badges52 bronze badges




9,5582 gold badges17 silver badges52 bronze badges












  • Thanks for the example! I wasn't able to fix it just based on the comments alone.

    – Ovi
    7 hours ago






  • 5





    It is often easier to show than explain.

    – John Kormylo
    7 hours ago

















  • Thanks for the example! I wasn't able to fix it just based on the comments alone.

    – Ovi
    7 hours ago






  • 5





    It is often easier to show than explain.

    – John Kormylo
    7 hours ago
















Thanks for the example! I wasn't able to fix it just based on the comments alone.

– Ovi
7 hours ago





Thanks for the example! I wasn't able to fix it just based on the comments alone.

– Ovi
7 hours ago




5




5





It is often easier to show than explain.

– John Kormylo
7 hours ago





It is often easier to show than explain.

– John Kormylo
7 hours ago

















draft saved

draft discarded
















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f499776%2fwhere-is-my-understanding-of-tikz-styles-wrong%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480