Hot answers tagged

12

With My Style/.style={draw=red, .code={\stepcounter{MyCounter}}}, your style My Style defines an unused blank key linked to your code. You may use : \tikzset{My Style/.style={draw=red,inc/.code={\stepcounter{MyCounter}},inc}} to define and use the inc key. Or you may use .code handler instead of .style handler: \tikzset{My Style/.code={\stepcounter{...


7

After answering this, I discovered that the OP already got an answer to this question in the follow-up comments on Harish Kumar's answer to an earlier question. In fact, my answer below was perfectly well known to the OP. I'm not certain what the real question here is, but I'm sure it is not the one asked and which I answered. [Perhaps the question should ...


5

See, if the following solution is acceptable to you: \documentclass[border=3mm,tikz]{standalone} \usetikzlibrary{calc,positioning, quotes} \makeatletter \def\tikzsavelastnodename#1{\let#1=\tikz@last@fig@name} \makeatother \newcommand\ppbb{path picture bounding box} \tikzset{% node distance=9mm and 12mm, shorten <>/.style = {% shorten ...


4

That's what a node does, and it can have a fill. What's the purpose of the figure environment? \documentclass{article} \usepackage{tikz} \newcommand{\fourcards}[4]{% \begin{figure} \centering \begin{tabular}{cccc} \tikz \node[draw,fill=green!50] {#1}; & \tikz \node[draw,fill=magenta] {#2}; & \...


4

This is a partial solution to get you going. This code was set up very nicely using styles, you can make a lot of adjustments by playing with the style block at the top of the tikzpicture environment. For example, if you change it to: \begin{tikzpicture}[ font=\sffamily, level/.style={black,thick}, sublevel/.style={black,densely dashed}, ...


4

I don't understand all the desiderata. I also don't know if an alternative approach is an option. But, for whatever it is worth, here's a forest solution. This satisfies the first 3 desiderata, in addition to applying the defined styles correctly. Whether it satisfies the fourth of the desiderata I cannot say. Since I don't understand that one, if it ...


4

Image actually present tree (as it also stated with selected tags of question), but was drawn as general graph. Wit use of tree way of drawing, code become very simple and concise: \documentclass[tikz, border=3mm]{standalone} \usetikzlibrary{arrows, quotes, %trees } \usepackage[latin1]{inputenc} \begin{document} \begin{tikzpicture}[ ...


3

pdftex has no information about the character other than four lengths height, depth, width, italic correction, it may be a black square or a white rectangle or look like an F so there is no way to avoid giving tex the corrections by hand, either on each instance or setting up a font-specific table of spacing corrections for each character


2

With \pgfplotsset{ errorBars/.style={ error bars/error bar style={ thick, }, error bars/y dir=both, error bars/y explicit, } } you can use \addplot[errorBars,style={red, fill=red}] or \addplot[style={red, fill=red},errorBars]. If all plots inside an axis environment should have error bars with this style, you can use every axis ...


2

Just change \node[main node] (a) {a}; to \node[main node] (a) {$v_1$}; and so on.


2

Do you want something like this? \documentclass[tikz,border=10pt,multi]{standalone} \usetikzlibrary{bayesnet,arrows.meta} \begin{document} \begin{tikzpicture} \node[const] (A) {$A$}; \node[const, below=1cm of A] (B) {$B$}; \edge [-Bar] {A}{B}; \end{tikzpicture} \end{document}


1

I'm not certain what result you're trying to achieve. Do you want something like this? \documentclass{article} \usepackage{calc} \usepackage{tikz} \usepackage{xstring} \usepackage{etoolbox} \newcommand{\drawbubble}[3]{% % \renewcommand{\rowlng}{\arabic{rowlng}}% % \renewcommand{\rowh}{\arabic{nrrows}}% \node [draw, rounded corners, thick, black] at ...


1

RunarTrollet has pointed me in the right direction. /.is if does really exactly what it states in the manual, and only that. There are two reasonable things you might expect that it doesn't do: When executing drawit/.is if=drawit, it doesn't store the current value of the key in the TeX-if. (So you have to initialise the value afterwards!) When executing ...



Only top voted, non community-wiki answers of a minimum length are eligible