Tag Info

Hot answers tagged

34

You can define the direction of the label by using label=<angle>:<label text>. To specify the distance on a per node distance, you have to supply it to the label options: label={[label distance=<distance>]<angle>:<label text>} \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[ every ...


31

This can be done by the decorations.text library gives you a text along path decoration. See the PGF/TikZ manual (v2.10) on page 337, section 30.6 Text decorations for more details. You can't draw and decorate the path at the same time directly, but can use postaction={..} to decorate the path after you have drawn it (Thanks goes to Alan Munn for this tip). ...


21

For these kinds of drawings I'd first inspect which is the most convenient way to locate nodes: you positioned manually the nodes, but in this case I think the matrix library and consequently to position the nodes in a matrix fashion is really convenient. But let's start first with the styles: \tikzset{multiplexor/.style={rectangle, draw, align=center, ...


20

The problem here is that TikZ applies some automatication (namely the \tikz@auto@anchor macro) that will overwrite your set anchor. We can either hijack a .code key that is applied very last in the node that is used internally for the label (yes, even after our own settings red, anchor=north) and which calls \tikz@auto@anchor: \tikzset{label ...


20

The following solution uses TikZ, but a minimal amount of hacks: \usepackage{tikz} \usetikzlibrary{matrix,decorations.pathreplacing} \begin{tikzpicture}[decoration=brace] \matrix (m) [matrix of math nodes,left delimiter=[,right delimiter={]}] { a & b & c & d \\ e & f & g & h \\ i & j & k & l ...


20

Update The result looks fine but perhaps the code can be improved. \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations,decorations.markings,decorations.text} \begin{document} \pgfkeys{/pgf/decoration/.cd, distance/.initial=10pt } \pgfdeclaredecoration{add dim}{final}{ \state{final}{% ...


20

You can use the fill key to “delete” the background. As the comments show you must care to set no other color after the fill key with color or just using the color name as an option. That will overwrite the color given to fill. As you can see in the example color set the color for filling, drawing and the text. \documentclass{article} \usepackage{tikz} ...


19

Here is a list of 710 keys (automatically extracted from the pgfmanual): > above above delimiter above left above left of above of above right above right of absolute accepting text accepting where alias align allow upside down ampersand replacement anchor and gate and gate IEC symbol append after command arrow box arrows arrow box east arrow arrow box ...


17

The tikz library decorations.text allows you to place text along a path. The default placement of the text is not very nice if you are trying to have the text on a line (this seems to be because the default assumption is that the text is the line). You can use the \pgftransform... commands to shift the text around. These are described in Section 79 of the ...


15

You can control the position of labels accurately with at={(axis description cs:0.5,-0.03)} The start of the axis is 0 and the end is 1. \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle, axis line style={->}, x label style={at={(axis description cs:0.5,-0.1)},anchor=north}, ...


14

I thought that it was an interesting plot. So I will supply my answer. To answer some of your questions: Is the groupplot command even the right one to approach to this "problem"? Yes, what groupplot does is simply letting them be side by side in an easier manor. Nothing more, nothing less. Every \nextgroupplot is effectively the same as an enclosed axis ...


14

This is a possible solution mainly based on How to generate n points on a circumference and connect all of them while having constraints on the image size? The adaptation from that code concerns how the labels and the colors are customized: I developed two ways basically circumference with labels which allows to customize both; they should be inserted as ...


14

\documentclass{article} \usepackage{tikz} \usetikzlibrary{fit} \begin{document} \begin{tikzpicture} \node [label=label1,draw] (node1) {Node1}; \node [label={[name=l] label2},draw] (node2) at (4,2){Node2}; \node[fit=(node1)(l), draw] {}; \end{tikzpicture} \end{document}


14

Good to know all the other ways to do this, but I have always used xshift=<length>, and yshift=<length> to move a node or label. The blue is the default, and the red is with the option [xshift=1.0cm, yshift=0.3cm], and the green (as suggested by percusse) is using an alternate syntax to specify the x and y shift as a vector ...


14

Instead of trying to populate the list of permitted symbolic coordinates, I would recommend to use the xticklabels from table key to set the labels. You don't need to provide an explicit ID column for this to work, you can just use x expr=\coordindex. As long as you also use xtick=data, the labels will always be assigned to the correct bars. ...


13

A label is just like any other node, so you have to specify the align of the label before the manual line breaks work, using \node [label={[align=left]<label text\\with line breaks>}] {<node text>}. Alternatively (again, like with any other node), you can specify the text width of the label, that way manual line breaks will work and the text will ...


13

The colour bar is a full-fledged axis environment, so all the usual options are available (like title). The ticks in this case are y ticks, so you can set the axis label using ylabel and the tick label style using yticklabel style: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.6} \begin{document} \begin{tikzpicture} ...


13

You can add \tikztonodes to the path construction in the main link. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \tikzset{ ncbar angle/.initial=90, ncbar/.style={ to path=(\tikztostart) -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$) -- ...


13

You can use raise to place the text \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.text} \begin{document} \begin{tikzpicture} \node (One) at (-3,0) [shape=circle,draw] {$One$}; \node (Two) at (3,0) [shape=circle,draw] {$Two$}; \draw [->,thick,postaction={decorate,decoration={raise=-2.5ex,text along path,text ...


13

Why do the blobs have tiny lines coming out of them every so often? Because the amplitude of the steps and the rounding radii are too similar. Reduce the radius or increase the amplitude and/or steps. You have to find right values by trial and error. Why are the corners of the blob at (4,1) and (14,1) not rounded? Because the path is not closed. ...


13

Here is another approach exploiting the append after command option. The point is that, by referring to the anchor \tikzlastnode.center one might add, relatively to that position, labels. The new style able to accomplish this task is my label: \tikzset{my label/.style args={#1:#2}{ append after command={ (\tikzlastnode.center) node [#1] {#2} } ...


12

Update: Most of the idea exposed in the initial version is now made automatically, adding support for unnumbered chapters: \documentclass[openany]{book} \usepackage{chappg} \usepackage{pgfplots} \usepackage{lipsum} \usepackage{nameref} \usepackage{showkeys} \definecolor{ylgnbu1}{RGB}{255, 255, 204} \definecolor{ylgnbu2}{RGB}{161, 218, 180} ...


12

scalebox should do the trick for you. You'll need the graphicx package. For example: \documentclass{article} \usepackage{graphicx} \usepackage{stackrel} \begin{document} \scalebox{3}{ $\stackrel[e+f+g+h^i]{a^b}{c d}$ } \end{document} For labels, you can use something like the following \begin{equation} H_{\mathrm{atom-light}}= ...


12

And a poor man's solution if compared to Claudio's answer :) \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \def\numofpoints{19} \def\circpatt{{1,0,0,1,1,0,0,1,0,1,1,0,0,0,1,0,0,1,2,3}} % 1 filled 0 empty \def\labelpatt{{1,11,2,12,3,13,4,14,5,15,6,16,7,17,8,18,9,19,10}} \node[circle,draw,minimum width=4cm] (bigc) {}; ...


12

Hmm! not really supported LaTeX syntax but \documentclass{article} \usepackage{amsmath} \newsavebox\labelbox \begin{document} \savebox\labelbox{$\begin{matrix} \refstepcounter{equation}(\theequation)\label{aa}\\ \refstepcounter{equation}(\theequation)\label{bb}\\ \refstepcounter{equation}(\theequation)\label{cc} \end{matrix}$} \[ \begin{bmatrix} ...


11

You must put the node direct after to \documentclass[crop,border=0]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} [>=latex] \node [draw,rectangle] (Start) {Start}; \node [draw,rectangle] (Finish) [right=2cm] {Finish}; \draw [->,out=90,in=90,looseness=0.75] (Start.north) to node[above]{above} (Finish.north); \draw ...


11

This is what I got: With this code: \documentclass{article} \usepackage{pgfplots,tikz,refcount,nameref,totcount,etoolbox} \usepackage{lipsum} %%%% Must be placed in the preamble %%% \newcounter{PlotMeCounter} \newcommand{\plotted}{\stepcounter{PlotMeCounter}\label{plotme:sec\arabic{PlotMeCounter}}} \makeatletter \newcommand{\lastplotted}{ ...


11

For this simple case, you can just draw a square at (A): \documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture} \draw ( 0 , 0 ) coordinate (A) -- ( 4 , 0 ) coordinate (C) -- ( 0 , 3 ) coordinate (B) -- (0, 0); \draw [fill=red](A) rectangle ++(0.5,0.5) node[above right]{$90^\circ$}; \end{tikzpicture} \end{document} ...


11

TeX is a programming language. \label and some other constructs define variables in this language. It is common for programming languages to allow only ASCII characters in variable names. You cannot, for example, write in C int Skjærgårdsøl; Skjærgårdsøl=5; etc. The same is with TeX. Update: as commenters tell us, nowadays some programming ...


11

It is safest to stick to a-zA-Z0-9. Punctuation characters like " and : are subject to being made active by babel. Babel goes to some effort to make things safe even if active but you depend on the individual definitions in the individual language files. Basically the internal key is a macro name and it's a good idea to stick to things that can easily be ...



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