Hot answers tagged

14

I suspected that your question How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables? was of the XY type. The usual problem in these cases is that you cannot build a table inside a \foreach statement, because table cells form groups. The strategy is to build the table body beforehand. ...


11

This is a modification of your original code. I think there are better ways of achieving this, using less explicit coordinates, but this is at least some inspiration. \documentclass[12pt,fleqn]{article} \usepackage[portuguese,brazil]{babel} \usepackage[latin1]{inputenc} \usepackage{tikz} \usepackage{xcolor} \begin{document} ...


10

Here's a version of the diagram constructed using the power tree-drawing package, forest, in combination with the TikZ libraries fit and backgrounds. Forest's relative node names are used to locate the coordinates to include in the shaded boxes, fit is used to ensure they are correctly included and backgrounds is used to add the shading behind the tree after ...


8

The points for the Voronoi diagram are the vertices of the dashed lines. The outer points are named A to I the two thick points are named K and L. The positions are extracted from the image by putting the cropped image in the background and putting a grid on it. The final document should not have the grid, thus it can be enabled by \gridtrue for the ...


8

It is not a bug. To treat { ... } as a TikZ scope - as opposed to just an ordinary TeX group - you need to load the scopes library. \documentclass[tikz,multi,border=10pt]{standalone} \usetikzlibrary{chains,scopes} \begin{document} \begin{tikzpicture}[node distance=1mm, every node/.style=draw,every join/.style=->] \draw [help lines] (0,0) grid (3,2); ...


7

Yes, with the calc library. See section 13.5.4 The Syntax of Distance Modifiers in the manual. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (3,1.2); \draw (A) -- (B) coordinate[midway] (M); \draw [blue,thick] ($(M)!0.5cm!270:(A)$) -- ($(M)!0.5cm!90:(A)$); ...


7

Here is an option using the through library of tikz. You have to choose the coordinates yourself. \documentclass{article} \usepackage{tikz} \usetikzlibrary{through} \begin{document} \begin{tikzpicture} \coordinate (a) at (-2,0); \coordinate (b) at (2,0); \draw[thick] (a) -- (b); \node [draw,circle through=(a),label=left:$H$] at (-2,1) ...


7

If --cycle does not work for you, one option would be to adjust the out and in angle so that the lines are at the same angle as what they are connecting to. This slightly changes the shape, so if that is not required to be that precise you can get (at 6400% zoom on the left hand side): Notes: On the left hand side I changed 270 to 250, but on the right ...


6

Obviously, this could be further simplified: \documentclass[tikz,border=10pt,multi]{standalone} \usepackage[T1]{fontenc} \usepackage[sc]{mathpazo} \usepackage{fp} \usetikzlibrary{fixedpointarithmetic,angles,quotes} \begin{document} \begin{tikzpicture}[x=0.75mm, y=0.75mm, font=\scriptsize, line width=.1mm] \def\k{7} ...


6

Package pdfrender (for pdfTeX/LuaTeX in PDF mode) can draw vector fonts with rendering mode "stroke", where the color and line width of the outlines can be configured. The following example uses \overline and \underline for the lines without the need for TikZ. \documentclass{article} \usepackage{lmodern} \usepackage{pdfrender} \usepackage{xcolor} ...


6

I am not sure what you mean by the "inner square color should overlap", but perhaps you just mean that there shouldn't be a black line between the inner and outside squares. If so, you probably want something like the following: This was produced by: \documentclass[border=5mm,tikz]{standalone} \usepackage{mwe} \usepackage{tikz} \begin{document} ...


5

Another possibility is the turn option. See section "13.4.2 Rotational Relative Coordinates" in the manual. \documentclass[margin=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \path (0,0)coordinate(A) -- coordinate(M) (3,1.2)coordinate(B) ; \path (A) -- (M) -- ([turn]90:.5)coordinate(l1) -- ...


5

I solved it with \node [annotation, right] at (n2.east) {$\bullet$ Französich unterrichten lernen \\ $\bullet$ Wie gestaltet man Unterricht?}; wit \textbullet instead of $\bullet$ for the first bullet point


5

The \makeatletter and \makeatother should enclose the whole \newcommand definition, so you should write it this way: \makeatletter \newcommand{\myBCOR}{\the\ta@bcor} \makeatother


5

The usual \newenvironment will work here. The syntax is \newenvironment{environmentname}{initial material}{final material} In your case you can write \newenvironment{myplot}{\begin{sansmath} \fontfamily{PTSansNarrow-TLF}\fontsize{11}{11}\selectfont \begin{tikzpicture} }{\end{tikzpicture}\end{sansmath}} to get a newenvironment myplot: ...


4

Try to use different names for each couple of coordinates: spypoint1 and magnifyglass1, then spypoint2 and magnifyglass2, etc. Result: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \usepgfplotslibrary{groupplots} \usetikzlibrary{spy} \begin{document} \begin{tikzpicture}[spy using outlines={circle, ...


4

Thank you, for the dupliacte link help, anyway as promised I will publish my blocks. They are mede of several posts, I hope I didn't made a mess. \documentclass[border=10pt]{standalone}%{article} \usepackage{tikz} \usepackage{graphicx} \usetikzlibrary{arrows,calc,positioning} \begin{document} \tikzset{ ...


4

A solution with forest Code \documentclass[12pt,twoside]{book}%{book} \usepackage[a4paper, hmargin={2.5cm, 2.5cm}, vmargin={2.5cm, 2.5cm},bindingoffset=6mm]{geometry} \usepackage{forest,mathtools} \forestset{ declare toks={elo}{}, % Edge Label Options anchors/.style={anchor=#1,child anchor=#1,parent anchor=#1}, dot/.style={tikz={\draw[blue,#1] ...


4

The missing text has been added as labels to the nodes. I defined a style addlabel for convenience. The amsmath package is added for the \text macro. For the missing lines, I use the syntax of the calc library to draw a line relative to the n0 node, and I add a coordinate at each end of that line (l1 and l2). The next two lines are drawn with perpendicular ...


4

A shorter but inflexible forest implementation: Code \documentclass[tikz]{standalone} \usepackage{forest}\usetikzlibrary{arrows.meta} \begin{document} \begin{forest} Pin/.style={pin={[pin edge={thin,shorten <=4\pgflinewidth,black,{Latex[round]}-, to path={-- (\tikztotarget.west)}}, pin distance=1.5cm, align=left] 10:Entrepreneur\\ sets ...


4

You could misuse the text width which does get taken in account for the node parts. However you need to subtract the inner xseps as well as the inner linewidths. As a non-empty text width value activates a minipage-like environment for the node part texts you need something like align=center if you want to have the texts back in the center. Note, that the ...


4

A workaround: \usetikzlibrary{bending}. Then the arrow heads of curved arrows are following the curve better: \documentclass{article} \usepackage{tikz} \usetikzlibrary{bending} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \draw node (A) at (-2,-2) {A} node (B) at ( 0,-3) {B} node (C) at (-2,-4) {C} ; \draw [name path=line] ...


4

\documentclass{beamer} \usepackage{tikz} \usetikzlibrary{decorations.pathreplacing} \begin{document} \begin{figure} \begin{centering} \begin{tikzpicture}[every edge/.style={shorten <=1pt, shorten >=1pt}] \draw (0,0) node [below] {0} -- (10,0) node [below] {1}; % draw the tick marks \coordinate (p) at (0,2pt); \foreach ...


4

A single brace is not a replacement for a proper TikZ scope which does quite a lot of nontrivial things. Hence you need to spell out the \begin{scope} then everything works properly. Thus, I wouldn't call this a bug but a typo in the documentation. \documentclass[tikz]{standalone} \usetikzlibrary{chains} \begin{document} \begin{tikzpicture}[node ...


3

Answer composed from the comments, therefore community wiki. \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \fill [yellow] (-2, -2) rectangle (0, 2); % fill left semisphere \draw [thin, gray, ->] (0,-2) -- (0,2) % draw y-axis line node [above, black] {$j\omega$}; % add label for y-axis \draw ...


3

\documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[circle, draw=black, fill=black, name=0] at (0,0) {}; \node[xshift=-2mm] at (0.west) {0}; \node[circle, draw=black, fill=black, name=1] at (0,1) {}; \node[xshift=-2mm] at (1.west) {1}; \node[circle, draw=black, fill=black, name=3] at (1,0) {}; ...


3

From page 726 in pgfmanual: When split vertically, the rectangle split will meet any minimum width requirements, but any minimum height will be ignored. Conversely when split horizontally, minimum height requirements will be met, but any minimum width will be ignored. In addition, inner sep is applied to every part that is used, so it cannot be ...


3

Use concept color=blue or draw=blue to override the inherited color settings from the mindmap nodes. \documentclass[12pt]{article} \usepackage[ngerman]{babel} \usepackage[a4paper, text={16.5cm, 25.2cm}, centering]{geometry} \usepackage[sfdefault]{ClearSans} \usepackage[utf8]{inputenc} \setlength{\parskip}{1.2ex} \setlength{\parindent}{0em} ...


3

Perhaps something like this, though some manual fiddling is required. Start by reducing the height of the boxes, by adding /pgfplots/boxplot/box extend=0.3 to the axis options. The default value is 0.8, adjust this to your liking. Then for each plot, set draw position to some value slightly above or below the tick value. E.g. draw position=1.2 and 0.8 as in ...


3

CFR and percusse both posted a much better solution to the code and provided a much better explanation for as to why the typo arose in the manual. One of them should be marked correct. Original post: You are correct in that it seems to be an error in the code. Simply moving the start chain into the optional part of \begin{tikzpicture} seems to correct ...



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