TikZ
- How to compile a TikZ picture where quotes are active chars by polyglossia in a Beamer presentationby miticollo on April 21, 2025 at 4:07 pm
Consider the following MWE: \documentclass{beamer} %\documentclass{article} \usepackage{polyglossia} \usepackage{tikz} \setdefaultlanguage[babelshorthands]{italian} \usetikzlibrary{quotes,babel} \begin{document} \begin{frame} \shorthandoff {"} \begin{tikzpicture} \node ["la mia etichetta" red, draw] {il mio nodo}; \end{tikzpicture} \shorthandon {"} \end{frame} \end{document} compiled with latexmk --halt-on-error --file-line-error -pdflualatex=/usr/local/texlive/2025/bin/x86_64-linux/lualatex -lualatex foo.tex But it fails ./foo.tex:21: Undefined control sequence. \italian@sh@"@ ...next {''}\else \def \xpgit@next {\futurelet \xpgit@temp \x... l.21 \end{frame} My goal is to use quotes syntax to create a node as label. But in Italian " is an active char. So to fix this issue I loaded babel library and added \shorthandoff. Effectively, these two solutions work when article class is used. To be honest, with article only babel library is required. Anyway I must create a Beamer presentation. I would want to know if this is a bug or this behaviour is documented somewhere and I missed it.
- Edge Label Font Size in Tikz Graphby bhache on April 21, 2025 at 2:32 pm
I am trying to make a graph with weighted edges using tikz inside a beamer class (the documentclass seems to be irrelevant). I want the edge labels (weights) to have a \tiny font size but I am not sure how to ensure that. I looked around the tikz documentation and still am unsure. Below is my MWE: \documentclass[ aspectratio=1610, % PDF hyperlinks, with coloured links hyperref={bookmarks, breaklinks, % for line breaks in links colorlinks, pdftex, }, ignorenonframetext, notheorems, xcolor={table, % more colour options usenames, dvipsnames, }, ]{beamer} %% Fonts & languages \usepackage[utf8]{inputenc} % type Unicode characters \usepackage[T1]{fontenc} % font encoding \usepackage[english]{babel} % multi-language support %% Colours & graphics \usepackage{pgfplots} % for plots \pgfplotsset{compat=1.18} % set package options globally \usetikzlibrary{graphs, graphs.standard, quotes, } \begin{document} \begin{frame}[t] \centering \begin{tikzpicture}[scale=1] \graph [clockwise=5]{% A, B, C, D, E; A -- {B [> "6", {font=\tiny}], C, D , E }; B -- {C, D, E}; C -- {D, E}; D -- {E}; }; \end{tikzpicture} \end{frame} \end{document} This results in the following: In the figure, I would like the edge label 6 to be smaller in size than the node labels A-E. I tried edge node style with desired font size using quotes syntax: [> "6", {font=\tiny}]. However, that did not resolve the issue. Any suggestions are be welcome.
- Genealogytree convention "not married any more"by Lukas on April 20, 2025 at 10:12 pm
Is there a convention to denote in a genealogytree-tree structure that someone is not married anymore? And if not, is there be a possibility to e.g. dash the existing line between nodes S2 and W1 in the following example: \documentclass{standalone} \usepackage[all]{genealogytree} \begin{document} \begin{tikzpicture} \genealogytree[id suffix=@a]{ parent{ g[male, id=S2]{S2} p[female]{P1} p[male]{P2} } } \genealogytree[id suffix=@b, set position=S2@b at S2@a]{ parent{ p[female]{W1} p[male, id=S2]{S2} g[female]{D1} } } \genealogytree[id suffix=@c, set position=S2@c at S2@a]{ parent{ p[male, id=S2]{S2} p[female]{W2} g[phantom]{} } } \end{tikzpicture} \end{document}
- Genealogytree phantom node placementby Lukas on April 20, 2025 at 10:04 pm
I stumbled upon the issue where a phantom node position seems not to align with a regular node placed at the assumed position: \documentclass{standalone} \usepackage[all]{genealogytree} \begin{document} \begin{tikzpicture} \genealogytree[id suffix=@a]{ parent{ c[male, id=S2]{S2} c[female,phantom]{W2} g[male]{S1} p[female]{P1} p[male]{P2} } } \genealogytree[id suffix=@c, set position=S2@c at S2@a]{ parent{ p[male, id=S2]{S2} p[female]{W2} g[phantom]{} } } \end{tikzpicture} \end{document} The phantom node in the first tree-structure is used as a placeholder for the second tree. The added node from the second tree (W2) intersects the first tree (node S1). How can I align the phantom node with the "real" node? Please note as this is part of a larger tree I can't put the node W2 to the left of S2.
- How can I draw this Blackbody emission curve? Can someone help me draw this?by Ismael Joaquim on April 20, 2025 at 9:47 am
I want to draw this curve using LaTeX. I don't have any idea to do that.
- Unexpected TikZ output in `let \n1={2pt}`by hbghlyj on April 20, 2025 at 3:14 am
In the following code, in the first plot I entered manually the rotated coordinates. In other words, each coordinate is transformed by the rotation matrix (using cos 25 and sin 25) as the function is sampled. In the second plot I use rotate=25 instead. \documentclass[tikz]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \draw let \n1={2pt} in plot({cos(25)*\x-sin(25)*\n1*\x},{sin(25)*\x+cos(25)*\n1*\x}) plot[rotate=25](\x,{\n1*\x}); \end{tikzpicture} \end{document} I think that two formulae are equivalent, but unexpectedly the two plots are not the same in the output. Why?
- Make a curvy like arrowby Dimitrios ANAGNOSTOU on April 19, 2025 at 9:27 pm
I want to create the following image: Here is my attempt. How to get the curvy like arrow as in the image? Thanks for any help! \documentclass[margin=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta, shapes, positioning, fit} \begin{document} \begin{tikzpicture}[node distance=1.5cm and 1.5cm, font=\small, >=Stealth] % Message en clair et bloc de chiffrement \node[align=center] (plaintext) {Message\\(Texte en clair)}; \node[draw, rectangle, thick, fill=white, right=of plaintext] (encrypt) {\textit{chiffrement}}; \node[draw, dotted, fit=(plaintext)(encrypt), inner sep=8pt, label=below:Expéditeur] (senderbox) {}; \draw[->, thick] (plaintext)--(encrypt); % Canal de communication \node[right=3cm of encrypt] (comm) {canal de communication}; % Flèche du chiffrement vers le canal avec étiquette \draw[thick, ->] (encrypt) -- node[below, midway]{Texte chiffré} (comm); % Bloc de déchiffrement et message final \node[draw, rectangle, thick, fill=white, right=3cm of comm] (decrypt) {\textit{déchiffrement}}; \node[right=of decrypt] (finalmsg) {Message}; \node[draw, dotted, fit=(decrypt)(finalmsg), inner sep=8pt, label=below:Destinataire] (receiverbox) {}; \draw[->, thick] (comm) -- (decrypt); \draw[->, thick] (decrypt) -- (finalmsg); % Espion \node[below=1cm of comm] (eaves) {Espion}; \draw[dashed, ->, thick] (comm.south) to[out=-90,in=90] (eaves); \end{tikzpicture} \end{document}
- tikz gradient not working on pathby Simon on April 19, 2025 at 1:37 pm
I am trying to fill a path using gradient, but it is not working. the Entire path is solid color. I tried \path and \shade but the result is the same. How to fill the path with gradient? Adding transparency to the corners would be a plus in a seperate example. \documentclass[letterpaper]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \pgfdeclarehorizontalshading{gradient}{100bp}{color(0bp)=(white); color(25bp)=(red); color(75bp)=(red); color(100bp)=(white)} \shade[shading=gradient, shading angle=0] (0,0) .. controls (0,2mm) and ({0.25*80mm},2mm) .. ({0.25*80mm},2mm) -- ({0.75*80mm},2mm) .. controls ({0.75*80mm},2mm) and (80mm,2mm) .. (80mm,0) .. controls (80mm,-2mm) and ({0.75*80mm},-2mm) .. ({0.75*80mm},-2mm) -- ({0.25*80mm},-2mm) .. controls ({0.25*80mm},-2mm) and (0,-2mm) .. (0,0) -- cycle; \end{tikzpicture} \end{document}
- Decision trees and region sections reproduction [duplicate]by o.spectrum on April 19, 2025 at 1:06 pm
Recently, I saw the following pictures in the lecture notes from my university's Machine Learning course. I am quite used to writing most of my assignments and other works with LaTeX, but I've never seen something like this before. I know that you can plot graphs using tikz, but how would I reproduce the structures (a decision tree and some partition of a square region) found in the attached image? Any help will be greatly appreciated.
- TeX for Baire category iterative sequence constructionby D.R on April 18, 2025 at 6:12 pm
When I teach the Baire category theorem, I write on the board the following diagram: I would like to have a TeX version of this diagram. The easiest possible solution would be with arrays, but then I can’t get the long underbraces and diagonal $\in$ symbols. Maybe this requires tikz? EDIT: this is what I managed to cook up with the help of some online tools and a lot of fiddling around. If anyone has a cleaner or better looking solution, I'm all ears. \documentclass{article} \usepackage{tikz} \usepackage{amsmath} \usepackage{amssymb} \usepackage{xcolor} \usetikzlibrary{decorations.pathreplacing, calc} \begin{document} \begin{tikzpicture}[x=1cm, y=-0.6cm, font=\footnotesize] % Constants \def\tab{0.7} \def\colstart{0} \def\rowskip{4} % distance in y between groups \def\subsetx{\colstart+6*\tab} % Top row \node[anchor=west] at (\colstart,0) {$V \qquad \cap U_1$}; \node[anchor=west] at (\subsetx,0) {$\subseteq V \cap U_1$}; % Underbrace \draw[decorate,decoration={brace,mirror,amplitude=5pt}] ($(0.0,0.3)$) -- ($(1.75,0.3)$); % Group Loop \foreach \n in {1,2,3} { \pgfmathsetmacro{\xbase}{\colstart + (\n)*\tab} \pgfmathsetmacro{\ybase}{(\n-1)*\rowskip + 1} % Vertical chain \node[anchor=west] at (\xbase,\ybase) {$\rotatebox[origin=c]{270}{$\supseteq$}$}; \node[anchor=west] at (\xbase,\ybase+1) {$\overline{B}_{\n}$}; \node[anchor=west] at (\xbase,\ybase+2) {$\rotatebox[origin=c]{270}{$\supseteq$}$}; \node[anchor=west] at (\xbase,\ybase+3) {$B_{\n} \qquad \cap U_{\the\numexpr\n+1\relax}$}; % Slanted x_n \node[red, rotate=30] at (\xbase-0.2,\ybase+3.4) {$x_{\n} \in $}; % Underbrace — only if not last group \ifnum\n<3 \draw[decorate,decoration={brace,mirror,amplitude=5pt}] (\xbase+0.0,\ybase+3.3) -- (\xbase+1.75,\ybase+3.3); \fi % Explicit intersection on RHS \edef\intersection{V} \foreach \k in {1,...,\the\numexpr\n+1\relax} { \xdef\intersection{\intersection\ \cap\ U_{\k}} } \node[anchor=west] at (\subsetx,\ybase+3) {$\subseteq \intersection$}; % Green arrow \draw[->, thick, green!70!black] (\xbase+0.6,\ybase+1.1) -- ++(0,-1.5) -- (\colstart+7*\tab,\ybase-0.4); \fill[green!70!black] (\xbase+0.6,\ybase+1.1) circle (2pt); } % Final line \pgfmathsetmacro{\finaly}{3*\rowskip + 5} \node[red] at (\colstart+4*\tab,\finaly) {$x_\infty$}; % Align the subseteq symbol with the others \node[anchor=east] at (\subsetx,\finaly) {$\in \overline{B}_n$}; \node[anchor=west] at (\subsetx,\finaly) {{\color{green!70!black}{$\subseteq V \cap U_1 \cap U_2 \cap \dots \cap U_n$}} $\quad \implies x_\infty \in V \cap \bigcap_{n=1}^\infty U_n$}; % Red path from x_1 to x_infty \draw[->, red, thick] (\colstart+1*\tab-0.45, 4.75) -- (\colstart+4*\tab-0.45, 1+4*4); \end{tikzpicture} \end{document}
- Is it possible to set the scale of predefined TikZ patterns?by Ferrous1 on April 18, 2025 at 5:53 pm
Predefined TikZ patterns have always worked quite well for me, with one exception: I could never figure out how to set a specific "scale" or "zoom factor", so to say. Currently, I am creating graphs with shapes that span over the better part of an A4 page's width, hence in some cases, the provided patterns like north west lines are visually too dense. The following straightforward sketch visualizes what I would like to achieve, ideally without needing to create a pattern from scratch: MWE: \documentclass[margin=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes,patterns} \begin{document} \begin{tikzpicture} \draw[pattern=north east lines] (0,0) rectangle ++(4,4); \end{tikzpicture} \end{document}
- Plot the cubic root function and its inverseby Dimitrios ANAGNOSTOU on April 18, 2025 at 12:06 pm
I want to plot the cubic root function and its inverse. I use the following code: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \begin{axis}[ width=0.8\textwidth, height=0.8\textwidth, axis equal, grid=both, xmin=-2, xmax=5, ymin=-2, ymax=5, axis lines=middle, xlabel={$x$}, ylabel={$y$}, legend pos=south east, legend style={draw=none}, ticklabel style={font=\scriptsize}, label style={font=\scriptsize}, legend style={font=\scriptsize} ] % Add unit vectors \draw[thick,-latex] (axis cs:0,0) -- (axis cs:0,1) node[midway, right, font=\scriptsize] {$\mathbf{j}$}; \draw[thick,-latex] (axis cs:0,0) -- (axis cs:1,0) node[midway, below, font=\scriptsize] {$\mathbf{i}$}; % Plot x^3 \addplot[ blue, domain=-2.5:2.5, samples=100, thick ] {x^3}; \addlegendentry{$x\mapsto x^3$} % Plot cubique(x) \addplot[ red, domain=0:2.5^3, samples=1000, thick ] {x^(1/3)}; \addlegendentry{$x\mapsto \sqrt[3]{x}=x^{1/3}$} % Plot y = x \addplot[ green, domain=-2.5:4.5, samples=100, dashed, thick ] {x}; \addlegendentry{$x\mapsto x$} % Plot cubique(x) pour les valeurs négatives \addplot[ red, domain=(-(2.5^3)):0, samples=2000, thick ] {-(-x)^(1/3)}; % Add the point (1.5, 3.3750) \node[circle,fill,inner sep=1.pt,label={[label distance=-1mm, font=\scriptsize] above right:{$(1.5, 3.375)$}}] at (axis cs:1.5,{1.5^3}) {}; % Add the point (3.3750, 1.5) \node[circle,fill,inner sep=1pt,label={[label distance=-1mm, font=\scriptsize] below :{$(3.375, 1.5)$}}] at (axis cs:3.375,1.5) {}; % Définition des points \coordinate (A) at (axis cs:1.5,3.375); \coordinate (B) at (axis cs:3.375,1.5); \coordinate (M) at (axis cs:{(1.5+3.375)/2},{(3.375+1.5)/2}); % Milieu de A et B % Traits pointillés entre A--M et M--B \draw[dashed] (A) -- (M); \draw[dashed] (M) -- (B); % Point M avec annotation \node[circle,fill,inner sep=1pt, label={[label distance=-1mm, font=\tiny] below:{$\left(\frac{1.5+3.375}{2}, \frac{3.375+1.5}{2}\right)$}}] at (M) {}; % Origine \node[label={[label distance=-1mm, font=\scriptsize] below left:{$O$}}] at (axis cs:0,0) {}; % Marque d'angle droit \draw ($(M)!2mm!(A)$) -- ++ ($($(M)!2mm!(axis cs:0,0)$)-(M)$) -- ($(M)!2mm!(axis cs:0,0)$); \end{axis} \end{tikzpicture} \end{document} I cannot understand the gap below: Any ideas to fix it (or even better to simplify the code)? Thanks!
- Problem with more than one macros in tikz's foreach loopby gschaaf on April 18, 2025 at 12:05 pm
I want to draw this image with tikz by using this code \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} % First matrix (4x3) \foreach \i in {0,...,2} { \pgfmathsetmacro{\value}{int(1+\i)} \draw (0,\i) rectangle ++(1,-1) node[midway] {\value}; \pgfmathsetmacro{\zeile}{int(3-\i)} \draw[<-,black] (1,1.5-\i) -- (2,1.5-\i) node[right] {\zeile. Zeile}; } \end{tikzpicture} \end{document} The numbers in the squares should be enumerated backwards: 3,2,1 and the rows (Zeilen) should be enumerated 1,2,3. However, the two macros are interfering and I end up with the same 3,2,1 order in both enumerations.
- PGFPlots: Coordinate Arithmetric, curious behavior when zero vector is not addedby Grass on April 18, 2025 at 7:00 am
The other day, I was absolutely puzzled by why my code didn't work. Turns out, adding the zero vector +(0,0) magically fixed everything. I'm curious to find out why, though unfortunately I have had no luck finding answers on the web so far. Could someone here explain this? \documentclass[tikz]{standalone} \usetikzlibrary{calc} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} % Nice, expected behavior \begin{tikzpicture} \begin{axis}[ xmin=-5, xmax=5, ymin=-5, ymax=5, ] \draw[thick,blue] (0,0) -- ($(0,0)+2*(axis direction cs:-1,1)$); \end{axis} \end{tikzpicture} % Inexplicable yeeting `to infinity' \begin{tikzpicture} \begin{axis}[ xmin=-5, xmax=5, ymin=-5, ymax=5, ] \draw[thick,blue] (0,0) -- ($2*(axis direction cs:-1,1)$); \end{axis} \end{tikzpicture} \end{document} The first tikzpicture produces while the second one produces
- \pgfplotsforeachungrouped to define different colorsby Angelo Aliano Filho on April 17, 2025 at 2:38 pm
I have the MWE: \documentclass[border=2mm,tikz]{standalone} \usepackage[T1]{fontenc} \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} \usepackage[italic]{mathastext} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel=$x$, ylabel=$y$, width=10cm, height=8cm, axis lines = middle, xmin=-8, xmax=8, ymin=-1, ymax=200, legend style = { at={(0,1)}, anchor=north west, font=\scriptsize, legend columns=1, legend cell align=left, %draw=none }, ] \addplot[color=red,domain=-4:2] {exp(x)}; \addlegendentry{$\exp x$} \edef\serie{0} \edef\contador{0} \pgfplotsforeachungrouped \n in {0,1,...,5}{ \edef\serie{ \serie+pow(x,\n)/factorial(\n) } \edef\contador{ \pgfmathparse{\contador+1} } \addplot[blue!\fpeval{100*\contador/6}!red,no marks,samples=100,smooth,line width=1pt]{\serie}; \addlegendentryexpanded{ordem $\the\numexpr\n$} } \end{axis} \end{tikzpicture} \end{document} I want to plot the Taylor Polinomials of exp(x). I would like to draw in different colors of blue and red. I have used \pgfplotsforeachungrouped structure and I need to weight the blue and red in each iteration (using the variable \contador and calculate the number 100*\contador/6 using \fpeval{...}. This works very wel when I work in tikz, not in PGFplots). I have defined the macro \contador but this not work. How can I define the 100% of blue when n=0 and 100% of red when n=5 in my plots?
- Dependency diagram (Tikz): code doesn't work [closed]by Andrew van der Spuy on April 17, 2025 at 10:54 am
I'm trying to draw a diagram using this code: \begin{document} begin{dependency}[arc edge, arc angle=60, text only label, label style={above}] \begin{deptext} he \&claim \& -ed \& he \& didn't \& know \& her\\ \end{deptext} \depedge{2}{3}{past} \deproot{2}{verb, past} \end{dependency} \end{document} I drew another diagram with practically identical code (in fact, a more complicated diagram. But for some reason the above code doesn't work Apparently, the compiler has a problem with the \end{dependency} command. Can anyone assist?
- How to use `tkz-euclide` with `pgfplots`by Mr.Hedge on April 17, 2025 at 12:56 am
Is there any way to make tkz-euclide compatible with pgfplots axis environment? Here is my code example where I want to add mark using \tkzMarkSegment but more often I want to find some line intersections or draw circles. Interestingly, simple \tkzLabelPoint works. \documentclass[tikz, margin=3mm]{standalone} \usetikzlibrary{ arrows.meta, positioning, } \usepackage{tkz-euclide} \usepackage{pgfplots} \usepackage[dvipsnames,table]{xcolor} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=-2.9, xmax=15.9, ymin=-3.9, ymax=15.9, xtick distance=1, ytick distance=1, xticklabels=\empty, yticklabels=\empty, extra y ticks={1}, extra y tick labels={$1$}, extra x ticks={1}, extra x tick labels={$1$}, axis lines=middle, axis line style={-Stealth}, xlabel={$X$}, ylabel={$Y$}, xlabel style={at={(ticklabel* cs:1)}, anchor=north east, font=\footnotesize}, ylabel style={at={(ticklabel* cs:1)}, anchor=north west, font=\footnotesize}, grid=both, grid style={dotted, gray!50}, set layers, clip mode=individual, axis equal image=true, % scale only axis, % unit vector ratio=2,1, ] \coordinate (A) at (axis cs:2,8); \coordinate (B) at (axis cs:10,2); \coordinate (S) at (axis cs:6,5); \draw[thick, black] (A)--(B); \draw[black, fill=black] (A) circle(1.5pt) (B) circle(1.5pt); \tkzLabelPoint[above left](A){$A$} \tkzLabelPoint[below right](B){$B$} \addplot [name path = A,domain=-2:15, samples=2, thick, color=Red] {4/3*x-3} node[pos=0.8, sloped, above, font=\footnotesize]{$y=\frac{4}{3}x-3$}; \draw[Green, fill=Green] (S) circle(1.5pt); \tkzMarkSegment[mark=|, pos=0.5](S,B) \end{axis} \end{tikzpicture} \end{document}
- Reproduce the image using TikZby Alberto Belmonte on April 16, 2025 at 7:40 pm
I'm working on some school notes, but my skills aren't enough to create something similar to the image. It's something much more clumsy. I'm sure that with TikZ something very similar can be done. Image: My code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark, shapes.geometric, shapes.arrows, fit, calc, positioning} \begin{document} \begin{tikzpicture} % Ecuación base \node[draw=none, font=\large] (equation) at (0,0) {$\sqrt[n]{a} = b$}; % Etiqueta de Índice (n) \node[draw=red, thick, rectangle, rounded corners, inner sep=5pt, align=center, color=red] (index) at (-2, 1.5) {Índice}; \draw[thick, red, ->] (index.east) -- (equation.north west); % Etiqueta de Radicando \node[draw=blue, thick, rectangle, rounded corners, inner sep=5pt, align=center, color=blue] (radicando) at (-2, 0) {Radicando}; \draw[thick, blue, ->] (radicando.east) -- (equation.west); % Etiqueta de Raíz \node[draw=green, thick, rectangle, rounded corners, inner sep=5pt, align=center, color=green] (raiz) at (2, 0) {Raíz}; \draw[thick, green, ->] (raiz.west) -- (equation.east); \end{tikzpicture} \end{document}
- Using \boxplot calculated whisker values to sort outliersby grandpapocketcandy on July 12, 2024 at 5:21 pm
I'm working on getting the \boxplot command from the 'statistics' package to calcualte the lower and upper whisker values of a data set read from a sinlge colum .txt file then use those whisker values to define a range, \minvalue and \maxvalue that can be used with a conditional structure to sort outlier data points from the original data set. I've got the \boxplot command to calculate the whisker and quartile values and preserve them with \xdef, so they can be used outside the \tikzpicture environment, but when I try to pass \minvalue and \maxvalue, along with the original data set to a \foreach loop that uses the 'xfp' package for floating point evaluation it doesn't work...The data in \checklist should be the data read in from data_0.txt, rather than the hardcoded values in \checklist. Data File (data_0.txt) 10.2 12.5 8.7 10.3 9.8 13.1 10.9 14.7 9.4 12.0 28.0 -2.2 \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{xifthen} \usepackage{xcolor} \usepackage{geometry} \geometry{ left=20mm, right=20mm} \usepackage{float} % For the [H] option %\usepackage{filecontents} \pgfplotsset{compat=1.18} % Adjust the compatibility version as needed \usepackage{tikz} % Load the statistics library for boxplot \usetikzlibrary{pgfplots.statistics} \usepackage{pgffor} % For the \foreach loop \usepackage{pgf} \usepackage{xfp} % For floating-point evaluation \begin{document} \begin{figure}[H] \begin{center} \caption{Boxplot with Median Value Printed. Data File: \texttt{data\_0.txt}} \begin{tikzpicture}[scale=1] \begin{axis}[ grid=both, boxplot, ymin=0, ymax=5, ] \addplot[ boxplot, fill=orange, thick ] table[y index = 0]{data_0.txt} [above] node at (boxplot box cs:\boxplotvalue{median},2) {Median \pgfmathprintnumber{\boxplotvalue{median}} \xdef\med{\boxplotvalue{median}} \xdef\uq{\boxplotvalue{upper quartile}} \xdef\lq{\boxplotvalue{lower quartile}} \xdef\uw{\boxplotvalue{upper whisker}} \xdef\lw{\boxplotvalue{lower whisker}} \xdef\av{\boxplotvalue{average}} \xdef\minvalue{\boxplotvalue{lower whisker}} \xdef\maxvalue{\boxplotvalue{upper whisker}}}; \end{axis} \end{tikzpicture} \end{center} \end{figure} \underline{\textbf{Boxplot Statistics:}} Median: \pgfmathprintnumber{\med} Upper Quartile: \pgfmathprintnumber{\uq} Lower Quartile: \pgfmathprintnumber[fixed, precision=3]{\lq} Upper Whisker: \pgfmathprintnumber[fixed, precision=3]{\uw} Lower Whisker: \pgfmathprintnumber[fixed, precision=3]{\lw} Min Value: \pgfmathprintnumber[fixed, precision=3]{\minvalue} Max Value: \pgfmathprintnumber[fixed, precision=3]{\maxvalue} % Define a list of numbers to check \def\checklist{2.6, 7.3, 17.3, 5.0, 10.0, 9.35, 8.5, 11.2, 6.7} minvalue = \minvalue \par maxvalue = \maxvalue \par % Iterate over the checklist \foreach \currentline in \checklist { currentline = \currentline \par \ifnum\fpeval{\currentline > \minvalue} = 1 \currentline{} is greater than \texttt{minvalue} \par% \ifnum\fpeval{\currentline < \maxvalue} = 1 \currentline{} Less than \texttt{maxvalue} \par \textcolor{blue}{In Range \minvalue{} to \pgfmathprintnumber[fixed, precision=3]{\maxvalue} } \par \else \currentline{} is greater than \texttt{maxvalue} \par \textcolor{green}{Out of range} \par \fi \else Less than \texttt{minvalue} \par \currentline{} \textcolor{red}{Out of range \minvalue{} to \maxvalue} \par \fi \par } \end{document}
- How to Properly Colorize PDF Figures in LaTeX: Fill Color and Transparency Problemsby Mycroft_47 on June 7, 2024 at 6:41 pm
I've been trying to include a monochromatic PDF vector figure in my LaTeX document and change its fill color directly within LaTeX, without using any external tools. I found two main solutions: Sol1: Setting the PDF color space to RGB and using the decodearray option in \includegraphics. Unfortunately, this method didn't work for me. Sol2: Using TikZ pictures. This method gave me better results but still isn't perfect. I'm running into two main problems with the TikZ method: Inconsistent Fill Color: Even though I used the same color for the top and bottom borders of the hlines in tblr, the colors of the figure and the \hline don’t look the same. Unwanted Background: The figure has a white background behind it, even though the original figure is black on a transparent background. I set fill=transparent!0 in the TikZ picture, but it didn’t fix the issue. Any suggestions on how to resolve these issues? Original figure is black (you can download it from here: "left_logo.pdf"). Shown on the right side of the attached image. Here’s the LaTeX code I’m using: \documentclass{article} \usepackage[table, dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{fadings} \usepackage{tabularray} \UseTblrLibrary{varwidth} \begin{document} \begin{tikzfadingfrompicture}[name=left] \node [fill=transparent!0,draw=none] {\includegraphics[width=2.05cm,height=2cm]{./Resources/Figures/left_logo}}; \end{tikzfadingfrompicture} \begin{titlepage} \pagecolor{gray} \begin{tblr}{ width=\textwidth, colspec = {Q[c,2.65cm]X[c]Q[c,2.65cm]}, rowspec = {Q[b]}, hlines={1pt, MidnightBlue}, measure=vbox} \fbox{ \begin{tikzpicture}[ outer sep=0pt, inner sep=0pt, baseline=(current bounding box.center)] \node[left color=MidnightBlue,right color=MidnightBlue,minimum width=2.16cm,minimum height=1.85cm]{}; \path[scope fading=left,fit fading=false]; \node[fill=transparent!0,minimum width=2.16cm+1mm,minimum height=1.85cm+1mm]{}; \end{tikzpicture}} &{ \textcolor{MidnightBlue}{Lorem ipsum dolor sit amet} \\ \textcolor{MidnightBlue}{Proin non mauris maximus, pretium} \\ \textcolor{MidnightBlue}{In convallis eros convallis nunc} \\ \textcolor{MidnightBlue}{Integer eleifend sit amet risus} \\ \textcolor{MidnightBlue}{Fusce vulputate ac felis et} }& \fbox{\includegraphics[width=2.05cm,height=2cm]{./Resources/Figures/left_logo}} \end{tblr} \end{titlepage} \end{document} Edit I forgot to mention that I'm compiling my document with LuaLaTeX.
- pgfplots: numbers are outside the diagramby Snorlax on April 12, 2023 at 2:33 pm
I have a little problem with the numbers that are supposed to indicate the size of the respective bars. These are a bit very far outside the actual diagram. Unfortunately, I can't see my mistake until now to adjust them accordingly, precisely because the diagram becomes much larger and no longer fits completely on the slide. \documentclass[10pt,% aspectratio=169,% ]{beamer} \usepackage[T1]{fontenc} \usepackage[utf8x]{inputenc} \usepackage{lmodern} \usepackage[english]{babel} \usepackage{pgfplots} \pgfplotsset{compat=1.18, /pgf/number format/use comma, table/col sep = comma} \usetikzlibrary{patterns} \begin{filecontents*}{tabellen/data1.csv} Substanz,x,Messung1,AbwMessung1,Messung2,AbwMessung2,Messung3,AbwMessung3,Messung4,AbwMessung4 Salzsäure [v\%/v],1,0.04,0.00,0.24,0.00,0.20,0.00,0.23,0.00 Natronlauge [g/L],2,0.00,0.50,0.78,0.44,0.54,0.00,0.88,0.00 Titanpentachlorid [g/L],3,0.00,0.00,1.39,0.05,0.00,0.00,0.99,0.00 Isopropanol [g/L],4,0.00,0.00,0.05,0.00,0.06,0.00,0.04,0.00 Benzol [g/mL],5,1.07,0.00,1.03,0.00,1.03,0.00,1.03,0.00 \end{filecontents*} \begin{document} \begin{frame}{Title} \begin{tikzpicture} \begin{axis}[ ybar=2pt, ylabel={Konzentration}, % width=\textwidth, height=\textheight, xticklabels from table={tabellen/data1.csv}{Substanz}, xtick=data, ticklabel style={/pgf/number format/.cd, use comma, 1000 sep = {}}, nodes near coords, every node near coord/.append style={ yshift=transformdirectiony(\myshift+1), anchor=center, rotate=90, font=\scriptsize }, ymajorgrids=true, legend pos= north east, legend cell align=right, ] \addplot [draw = blue, fill = blue!30!white, error bars/.cd, y dir=both, y explicit, error mark=triangle*, error bar style={color=black}] table[ x=x, y=Messung1, y error=AbwMessung1, visualization depends on=1.25*\thisrow{AbwMessung1} \as \myshift, ] {tabellen/data1.csv}; \addlegendentry{1. Messung}; \addplot [draw = red, fill=red!30!white, error bars/.cd, y dir=both, y explicit, error mark=triangle*, error bar style={color=black}] table[ x=x, y=Messung2, y error=AbwMessung2, visualization depends on=1.25*\thisrow{AbwMessung2} \as \myshift, ] {tabellen/data1.csv}; \addlegendentry{2. Messung}; \addplot [draw = green, fill=green!30!white, error bars/.cd, y dir=both, y explicit, error mark=triangle*, error bar style={color=black}] table[ x=x, y=Messung3, y error=AbwMessung3, visualization depends on=1.25*\thisrow{AbwMessung3} \as \myshift, ] {tabellen/data1.csv}; \addlegendentry{3. Messung}; \addplot [draw = violet, fill=violet!30!white, error bars/.cd, y dir=both, y explicit, error mark=triangle*, error bar style={color=black}] table[ x=x, y=Messung4, y error=AbwMessung4, visualization depends on=1.25*\thisrow{AbwMessung4} \as \myshift, ] {tabellen/data1.csv}; \addlegendentry{4. Messung}; \end{axis} \end{tikzpicture} \end{frame} \end{document}
- Fix the postion of tikzpicture [duplicate]by PiHal on April 12, 2023 at 11:17 am
I have a trouble in fixing the position of a tikzpicture when there is overlay. In the example, due to the overlay of the texts below the picture, the picture will float a bit. However, I would like the picture to be fixed at the exact position, such that when I scroll the pages the effect looks like only the text is changing but the picture doesn't move at all. Here is my example: \documentclass[10pt,xcolor={dvipsnames}]{beamer} \usepackage{tikz} \begin{document} \begin{frame}{title} \begin{center} \begin{tikzpicture} \tikzset{ round node/.style={circle,draw,inner sep=1.5} } \node [round node] (1) {1}; \end{tikzpicture} \end{center} \begin{itemize} \only<1>{ \item By convention, we do not draw the information sets that contain a single node \item Therefore, any uncircled (or unlinked) decision node should be understood as a \textbf{singleton} information set} \item<2> In Figure (b), \textbf{player 2 has two singleton information sets}: \begin{itemize} \item The left one: player 2 knows that player 1 has chosen H \item The right one: player 2 knows that player 1 has chosen T \end{itemize} \end{itemize} \end{frame} \end{document} Remark: I don't use \uncover or \onslide because I don't want to leave blank space.
- How can I remove the Labels of the blue dots on the left plot and change the position of label nr16 in the right plot?by dan1365 on March 30, 2023 at 9:46 am
\documentclass[11pt]{report} \usepackage{pgfplots, pgfplotstable} \pgfplotsset{width=10cm,compat=1.18} \usepackage{graphicx} \usepackage{caption} \usepackage{subcaption} \begin{document} \begin{figure} \centering \begin{subfigure}[tb]{0.48\linewidth} \begin{tikzpicture} \begin{axis}[height=7cm, width=\linewidth, xlabel={}, ylabel={}, ytick={0,500,...,1700}, xtick={0,500,...,1700}, ymin=-170, ymax=1700, xmin=-170, xmax=1700, ymajorgrids, xmajorgrids] \addplot[ scatter/classes={0={blue}, 1={red}}, scatter, mark=*, only marks, scatter src=explicit symbolic, nodes near coords*={\Label}, visualization depends on={value \thisrow{label} \as \Label} %<- added value ] table [meta=class] { x y class label 0.3788 8.1653 0 - 6.3716 4.0196 0 - 0.4225 0.1447 0 - 14.8118 6.6124 0 - 2.7433 2.544 0 - 152.0046 30.6336 1 5 1375 428.5714 1 6 20.51 5.1280 0 - 38.8548 1492.8425 1 8 0.1409 0.000196 0 - }; \end{axis} \end{tikzpicture} \caption{} \label{} \end{subfigure}\hfill \begin{subfigure}[tb]{0.48\linewidth} \begin{tikzpicture} \begin{axis}[height=7cm, width=\linewidth, xlabel={}, ylabel={}, ytick={0,2,...,10}, xtick={0,5,...,20}, ymin=-1.133, ymax=11.333, xmin=-2.266, xmax=22.666, ymajorgrids, xmajorgrids] \addplot[ scatter/classes={0={blue}, 1={red}}, scatter, mark=*, only marks, scatter src=explicit symbolic, nodes near coords*={\Label}, visualization depends on={value \thisrow{label} \as \Label} %<- added value ] table [meta=class] { x y class label 0.3788 8.1653 0 9 6.3716 4.0196 0 10 0.4225 0.1447 0 12 14.8118 6.6124 0 13 2.7433 2.544 0 14 20.51 5.1280 0 15 0.1409 0.000196 0 16 }; \end{axis} \end{tikzpicture} \caption{} \label{} \end{subfigure}\hfill \caption{} \end{figure} \end{document} > Blockquote
- Position the beginning node of a graph with respect to another nodeby likethevegetable on December 8, 2020 at 5:39 pm
I would like to start a graph's first node (G1) with respect to another pre-existing node (N1), using the positioning library. I would like it to appear as follows: N1 G1 - - G2 N2 I've included a MWE below. My first attempt was to specify \path[below=of N1] at the beginning of the graph, but that did not work as the G1 and the following graph were in line. My second attempt which brings me very close to what I want, is to define a coordinate [below=of N1](Gstart), and shift the graph. The slight issue with this is that G1 is slightly offset (see the red ink I've marked up the picture with). Note that I can position node N2 wrt the graph node G2 as I expected. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,graphs} \begin{document} \begin{tikzpicture}[inner sep = 0pt, outer sep = 0pt,] \tikzset{node distance = 1cm and 2cm} \node (N1) {N1}; %%% First attempt \path[below=of N1] graph [grow right sep=2cm]{ G1 -- P/ -- G2}; %%% graph doesnt start below if I try this %%% My solution, gets me a bit close, but the graph is horizontally offset a bit \coordinate [below=of N1](Gstart); \path[shift={(Gstart)}] graph [grow right sep=2cm]{ G1 -- P/ -- G2}; %%% graph doesnt start below \node (N2) [below=of G2] {N2}; \end{tikzpicture} \end{document}
- Remove Zero as Chapter Number in Header Using scrlayer-scrpageby Echo on April 9, 2020 at 7:16 pm
I am currently working on a layout for a document (based on this post and this), using scrbook with scrlayer-scrpage. After a long struggle to get lines with rounded corners in the header and footer, everything works as expected -- except the numbering of the table of contents in the header. For some reason that I do not understand (I am sure because lack of basic knowledge) it gets a chapter number 0 and section number 0.0, instead of an empty field, which is the desired output for unnumbered chapters. When I compile my document with the slightly modified original code for the header no numbers are given for the table of contents. Based on this, my idea was to use \ifnumbered{chapter}{THEN}{ELSE}, either by redefining \chaptermarkformat and \sectionmarkformat (IDEA 1) or by changing the output for \lehead{} (and \rohead{} IDEA 2). What am I missing? Any help is much appreciated. Thank you in advance. Here is the code containing my approaches and the modified original code for the header and footer for camparison: \documentclass[12pt,paper=a4,DIV=calc,parskip=off,numbers=noenddot,chapterprefix=false]{scrbook} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage[ngerman]{babel} \usepackage[T1]{fontenc} \usepackage{calc} \usepackage[dvipsnames]{xcolor} \usepackage[inner=1.5cm,outer=3.0cm,top=1.5cm,bottom=2cm,headheight=8mm,headsep=1cm,footskip=1cm,includeheadfoot]{geometry} % ,showframe \setlength{\marginparwidth}{2.77cm} \setlength{\marginparsep}{.2cm} \usepackage[onehalfspacing]{setspace} % Chapter Title Layout ------------------------------------------------- % BASED ON: https://tex.stackexchange.com/questions/423091/chapter-heading-designs-in-koma-script \usepackage{tikz} \usetikzlibrary{positioning, backgrounds} \usepackage[outline]{contour} \contourlength{1.25pt} \usepackage{tikzpagenodes} \renewcommand\raggedchapter{\raggedright} \setkomafont{chapter}{\Huge} \setkomafont{chapterprefix}{\LARGE} \newkomafont{chapternumber}{\bfseries\fontsize{75pt}{75pt}\selectfont} \tikzset{ headings/base/.style = { outer sep = 0pt, inner sep = 0pt, %draw, rectangle % just for testing purposes }, headings/chapterbackground/.style = { headings/base, % if shades are to be used (gave ugly results for the shading): % shade, % left color = white, % right color = black, % without shades: color = black }, headings/chapapp/.style = { headings/base, text = black, font = \usekomafont{chapterprefix} }, headings/chapternumber/.style= { headings/base, text = black, font = \usekomafont{chapternumber} } } \makeatletter \renewcommand*\chapterlinesformat[3]{% \ifstr{#1}{chapter}{% \begin{tikzpicture}[baseline=(title.base)] \node[headings/base,anchor=center](title){% \parbox[t]{\dimexpr\textwidth\relax} {\parbox[t][\height]{\dimexpr\textwidth\relax}{\raggedchapter{#3}}\strut}% {\raggedchapter{\leavevmode\vphantom{\textbf{Ôp'}}#3}} //orig: {\raggedchapter #3} }; % chapter number \ifstr{#2}{} { % a phantom chapternumber is set to achieve the same vertical spacing for toc and other unnumbered chapters as for numbered chapters \node(chapternumber)[anchor=south west,headings/chapternumber] at([yshift=-14.5pt] title.north east){\leavevmode\vphantom{88}};% \fill[headings/base,anchor=north west,rounded corners=2.5 pt] ([xshift=4 pt]chapternumber.north west) rectangle ([yshift=-7 pt,xshift=.33\marginparwidth+4 pt]chapternumber.north west);% \fill[headings/base,color=black!85,anchor=north west,rounded corners=2.5 pt] ([yshift=-9 pt,xshift=5.5pt]chapternumber.north west) rectangle ([yshift=-16 pt,xshift=.33\marginparwidth+5.5pt]chapternumber.north west);% \fill[headings/base,color=black!70,anchor=north west,rounded corners=2.5 pt] ([yshift=-18 pt,xshift=9pt]chapternumber.north west) rectangle ([yshift=-25 pt,xshift=.33\marginparwidth+9pt]chapternumber.north west);% \fill[headings/base,color=black!50,anchor=north west,rounded corners=2.5 pt] ([yshift=-27 pt,xshift=16.5pt]chapternumber.north west) rectangle ([yshift=-34 pt,xshift=.33\marginparwidth+16.5pt]chapternumber.north west);% \fill[headings/base,color=black!20,anchor=north west,rounded corners=2.5 pt] ([yshift=-36 pt,xshift=30pt]chapternumber.north west) rectangle ([yshift=-43 pt,xshift=.33\marginparwidth+30pt]chapternumber.north west);% \fill[headings/base,color=black!10,anchor=north west,rounded corners=2.5 pt] ([yshift=-45 pt,xshift=52pt]chapternumber.north west) rectangle ([yshift=-52 pt,xshift=.33\marginparwidth+52pt]chapternumber.north west);% } { % number definition for numbered chapters \node(chapternumber)[anchor=south west,headings/chapternumber] at([yshift=-14.5pt] title.north east){#2};% } % decorative element(s) \ifstr{#2}{}{}{ \fill[headings/chapterbackground,anchor=east,rounded corners=1 pt] ([yshift=11.5 pt]title.north east) rectangle ([yshift=13.5 pt,xshift=4.2 cm]title.north);% } % chapter prefix \node(chapapp)[headings/chapapp,anchor=north east] at (chapternumber.north west){\ifstr{#2}{}{\leavevmode\vphantom{\contour{white}\chapapp}}{\contour{white}\chapapp}\strut};% \end{tikzpicture} \par }{% \@hangfrom{#2}{#3}% other section levels using style=chapter }% } \makeatother % Header and Footer Layout -------------------------------- \usepackage[automark]{scrlayer-scrpage} \setkomafont{pageheadfoot}{\footnotesize} \setkomafont{pagehead}{\sffamily\normalsize} \setkomafont{pagenumber}{\sffamily\large} \clearpairofpagestyles \newlength{\vrulewidth} \setlength{\vrulewidth}{1.25 pt} \renewcommand\chaptermark[1]{% \markboth{\ifnumbered{chapter}{#1}{#1}}{\ifnumbered{chapter}{#1}{#1}}% } % IDEA 1: Supposed to remove chapternumber from header in table of contents -- does not % \renewcommand*{\chaptermarkformat}{% % \ifnumbered{chapter}{\chapappifchapterprefix{\ }\thechapter\autodot\enskip}{}% taken from scrguide % } \renewcommand\sectionmark[1]{% \markright{\ifnumbered{section}{#1}{#1}}% } % IDEA 1 (part 2): Supposed to remove sectionumber from header in table of contents -- does not % \renewcommand*{\sectionmarkformat}{% % \ifnumbered{section}{\thesection\autodot\enskip}{}% taken from scrguide % } \lehead{% % \ifnumbered{chapter}{% IDEA 2: Supposed to remove chapternumber from header in table of contents -- does not \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south east,rounded corners=0.5\vrulewidth] ([xshift=-\marginparsep+.5\vrulewidth] current page header area.south west) rectangle ([xshift=-\marginparsep-.5\vrulewidth,yshift=\baselineskip] current page header area.south west); \node[headings/base,anchor=south east] at ([xshift=-2\marginparsep] current page header area.south west){\ifnumbered{chapter}{\leavevmode\vphantom{\headmark\strut}\chaptermarkformat}{\leavevmode\vphantom{\headmark\strut}}}; \node[headings/base,anchor=south west] at (current page header area.south west){\headmark\strut}; \end{tikzpicture} % }% IDEA 2 (part 2) % {% % \begin{tikzpicture}[overlay,remember picture] % \fill[headings/base,color=black,anchor=south east,rounded corners=0.5\vrulewidth] % ([xshift=-\marginparsep+.5\vrulewidth] current page header area.south west) % rectangle % ([xshift=-\marginparsep-.5\vrulewidth,yshift=\baselineskip] current page header area.south west); %% \node[headings/base,anchor=south east] at ([xshift=-2\marginparsep] current page header area.south west){\ifnumbered{chapter}{\leavevmode\vphantom{\headmark\strut}\chaptermarkformat}{\leavevmode\vphantom{\headmark\strut}}}; % \node[headings/base,anchor=south west] at (current page header area.south west){\headmark\strut}; % \end{tikzpicture} % } } \rohead{% (IDEA 2 did not work for \lehead) \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south west,rounded corners=0.5\vrulewidth] ([xshift=\marginparsep-.5\vrulewidth] current page header area.south east) rectangle ([xshift=\marginparsep+.5\vrulewidth,yshift=\baselineskip] current page header area.south east); \node[headings/base,anchor=south west] at ([xshift=2\marginparsep] current page header area.south east){\ifnumbered{section}{\leavevmode\vphantom{\headmark\strut}\sectionmarkformat}{\leavevmode\vphantom{\headmark\strut}}}; \node[headings/base,anchor=south east] at (current page header area.south east){\headmark\strut}; \end{tikzpicture} } \lefoot*{% \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south east,rounded corners=0.5\vrulewidth] ([xshift=-\marginparsep+.5\vrulewidth] current page footer area.south west) rectangle ([xshift=-\marginparsep-.5\vrulewidth,yshift=-3\baselineskip] current page footer area.south west); \node[headings/base,anchor=south east] at ([xshift=-2\marginparsep,yshift=-3\baselineskip] current page footer area.south west){\pagemark\strut}; \end{tikzpicture}% } \rofoot*{% funktioniert ohne * nur auf nicht chapter-Seiten \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south west,rounded corners=0.5\vrulewidth] ([xshift=\marginparsep-.5\vrulewidth] current page footer area.south east) rectangle ([xshift=\marginparsep+.5\vrulewidth,yshift=-3\baselineskip] current page footer area.south east); \node[headings/base,anchor=south west] at ([xshift=2\marginparsep,yshift=-3\baselineskip] current page footer area.south east){\pagemark\strut}; \end{tikzpicture}% } % https://tex.stackexchange.com/questions/272824/pagenumbers-headers-with-vertical-lines-style %% here there are no numbers for the table of contents in the headings -- numbering in TOC as desired % \renewcommand*{\chaptermark}[1]{% % \markboth{% % \makebox[0pt][r]{% % \ifnumbered{chapter}{% % \chaptermarkformat% Kapitelnummer % %\enskip% Abstand -- wird zu groß, wenn nicht auskommentiert % \rule[-\dp\strutbox]{\vrulewidth}{\baselineskip}% Linie -- Offset,Breite,Höhe % \hspace*{\marginparsep}% Abstand % }{}% % }% % #1% Text % }{% % #1%Text % \makebox[0pt][l]{% % \hspace*{\marginparsep}% Abstand % \ifnumbered{chapter}{% % \rule[-\dp\strutbox]{\vrulewidth}{\baselineskip}% Linie -- Offset,Breite,Höhe % \enskip% Abstand % \chaptermarkformat% Kapitelnummer % }{}% % }% % }% % } % \renewcommand*{\sectionmark}[1]{% % \markright{% % #1%Text % \makebox[0pt][l]{% % \ifnumbered{section}{% % \hspace{\marginparsep}% Abstand % \rule[-\dp\strutbox]{\vrulewidth}{\baselineskip}% Linie -- Offset,Breite,Höhe % \enskip% Abstand % \sectionmarkformat% Abschnittsnummer % }{}% % }% % }% % } % \ohead{\headmark} % \rofoot*{% % \makebox[0pt][l]{% % \hspace{\marginparsep}% % \raisebox{0pt}[\ht\strutbox][\dp\strutbox]{% % \rule[-\dp\strutbox]{\vrulewidth}{2\baselineskip}% Linie -- Offset,Breite,Höhe % }% % \enskip % \pagemark % }% % } % \lefoot*{% % \makebox[0pt][r]{% % \pagemark % \enskip % \raisebox{0pt}[\ht\strutbox][\dp\strutbox]{% % \rule[-\dp\strutbox]{\vrulewidth}{2\baselineskip}% Linie -- Offset,Breite,Höhe % }% % \hspace{\marginparsep}% % }% % } \usepackage{blindtext} \usepackage[raiselinks,colorlinks,bookmarks,pageanchor,hyperindex]{hyperref} \hypersetup{linkcolor=RoyalBlue} \begin{document} \markboth{Inhaltsverzeichnis}{Inhaltsverzeichnis} \setcounter{page}{1} \pagenumbering{Roman} \tableofcontents \setcounter{tocdepth}{3} \clearpage \setcounter{page}{1} \pagenumbering{arabic} \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \appendix \Blinddocument \end{document} Edit: here are some images to visualize the differences: EDIT: I just figured out (here) that the problem is that \ifnumbered{chapter} checks the value of secnumdepth which is not altered in the header, as far as I understood, and a redefinition of chaptermark is needed. My redefinition is obviously not enough for the intended result.
- How do I draw only the beginning and the end of an arrow from one node to another?by pulp_user on June 13, 2019 at 9:32 pm
I am trying to create a node-network using pdflatex and have something very specific in mind. Below, you can find my current minimal example as a tex file that I have a problem with (compilable with pdflatex): \documentclass[tikz, 11pt,landscape]{article} \usepackage[default,osfigures,scale=0.95]{opensans} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{tgbonum, tikz} \usetikzlibrary{shapes, calc, arrows.meta, fadings, decorations.pathmorphing, math} \usepackage[a3paper]{geometry} \begin{document} \thispagestyle{empty} \tikzset{normal/.style = {rectangle split, rectangle split horizontal, rectangle split parts=3, very thick, draw=black, inner sep=0cm, minimum height=0.6cm, text height=1.5ex, text depth=0.25ex}} \begin{tikzpicture}[remember picture, overlay] \path[draw, color=gray, thick] ($(current page.center) + (-10, 0)$) -- ($(current page.center) + (10, 0)$); \path[draw, color=gray, thick] ($(current page.center) + ( 0,-10)$) -- ($(current page.center) + ( 0,10)$); \node[normal] (66) at ($(current page.center) + ( 4.0, 2.0)$) {\nodepart[text width=6mm]{one} \nodepart{two}\rule[-0.25ex]{0pt}{1.75ex}\phantom{j}Node1\phantom{j}\nodepart[text width=6mm]{three}}; \node[normal] (75) at ($(current page.center) + (-4.0,-0.5)$) {\nodepart[text width=6mm]{one} \nodepart{two}\rule[-0.25ex]{0pt}{1.75ex}\phantom{j}Node2\phantom{j}\nodepart[text width=6mm]{three}}; %PROBLEM \draw[-{Latex[length=3mm]}, very thick] (66.west)--(75.east) node[midway,circle,inner sep=0.5mm,fill=white]{5}; \end{tikzpicture} \end{document} This creates a DIN A3 pdf with the following content (zoomed in to show the relevant part): The only part of the tex file that causes me headaches is the line after the "%PROBLEM"-comment. It draws the connection between the two nodes with a value in the middle. I want to be able to replace this arrow with an arrow that is basically cut in half, with a gap between the two parts, as seen in the following image (I'm giving you my best paint skills here): The middle should be transparent (not white, as this may overlay other things), and the number that was in the middle of the arrow before should be in the middle of the end piece. Furthermore, The arrow should be colorable (I could figure that out on my own I guess, but it's not my focus now) and I want to be able to control the length of the edge pieces as a fraction of the original distance. So for the situation below: I want to be able to change the lengths of the parts from 0.3 and 0.2 to 0.4 and 0.5 by just changing two numbers, and not a bunch of calculations. This is important, since this tex file will be programmatically generated and will contain many nodes, so I can't have a lot of special cases. I thought I might approach this by drawing two arrows instead of one and calculating the relevant points. First I calculate the end point (a) and the start point (b) and draw a connection: \def \a{($(75.east) - (current page.center) + (14.1, -10.9)$)}; \def \b{($(66.west) - (current page.center) + (14.1, -10.9)$)}; \draw[very thick] \b--\a; For some reason I do not know, the coordinate system of these seems to be offset. Through trial and error I found out that I could negate this offset by subtracting (current page.center) - (14.1, -10,9). This produces: So: Success. Then I calculate intermediary points (c) and (d) and try to draw two connections: \def \a{($(75.east) - (current page.center) + (14.1, -10.9)$)}; \def \b{($(66.west) - (current page.center) + (14.1, -10.9)$)}; \def \c{($\a + (0.3 * (\a - \b))$)}; \def \d{($\b - (0.2 * (\a - \b))$)}; \draw[very thick] \c--\a; \draw[very thick] \b--\d; Which does not compile with the error: Runaway argument? \a + (0.3 * (\a - \b ))$)--\a ; \draw [very thick] \b --\d ; \end {ti\ETC. ! Paragraph ended before \tikz@cc@parse@factor was complete. And I have absolutely no idea what to do about this. I did a bunch of trial and error without success: rearranging the formulas, trying different draw commands, with and without spacing, braces, parentheses and so on. I also tried to solve this with fading using something like this and making a color transparent, but that seems overly complicated and didn't succeed either. I guess my calculations are wrong? But I am simply way to much of a tex noob to understand why this is failing. I would be glad if any of you can help!
- Problem When Compiling with Tikzby verifying on January 18, 2018 at 3:42 pm
When I include the package tikz on my latex header, even if the package is not used at all, I get the following error at compiling time: Undefined control sequence. l.1131 \pgfdeclarearrow {name=|<->|, means={>[sep=0pt].|}} where l.1131 is line 1131 of the file "tikz.code.tex" A minimal example for this error is the following. \documentclass{article} \usepackage{tikz} \begin{document} test \end{document} So could be the mistake?
- I want to organize three images in a frame, simulating the effect of a zoom,by JuanMuñoz on November 30, 2014 at 7:26 pm
I have three images, I want to organize them in a frame to cause the effect of a zoom, similar to the image I have posted above. In this image the galaxy is at left, but i want to learn how to modified this position in the code, becouse acctually I need the second image(in our case, the Solar System) at right. It is no necessarily that one image overlap the other, but it is not a problem if this occurs I have no clue how to do it, any advice?
- How can we make a pumpkin, jack-o-lantern, or other halloween spirit, ghoul, or skeleton?by A.Ellett on October 31, 2014 at 7:04 pm
We have questions about Christmas trees and Hearts for Valentines but we have no questions that specialize in Halloween or Dia de los Muertos art. Here it goes: Using TikZ or PSTricks or any other of your favorite LaTeX tools, create pumpkins, ghouls, etc., appropriate to the season. I think multiple submissions should be fine provided different objects are created.
- Your best snowflake with Tikzby Thomas on December 18, 2013 at 8:48 pm
Christmas is coming, show me your best snowflakes made with Tikz 🙂 \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{decorations.fractals} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[decoration=Koch snowflake] \draw decorate{decorate{decorate{decorate{(0,0) -- (3,0)}}}}; \draw decorate{decorate{decorate{decorate{(3,0) -- (1.5,-3)}}}}; \draw decorate{decorate{decorate{decorate{(1.5,-3) -- (0,0)}}}}; \end{tikzpicture} \begin{tikzpicture} \begin{axis}[axis lines=none] \addplot+[domain=0:2*pi,samples=1000,mark=none, color=black] ({10*cos(deg(x)) + 2*cos(deg(4*deg(x))) + 2*cos(deg(10*deg(x)))}, {10*sin(deg(x)) + 2*sin(deg(4*deg(x))) + 2*sin(deg(10*deg(x)))}); \end{axis} \end{tikzpicture} \end{document} EDIT : \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{shadings} \definecolor{LightBlack}{rgb}{.4,.4,.4} \definecolor{SoftBlack}{rgb}{.2,.2,.2} \begin{document} \begin{tikzpicture} \fill[top color=LightBlack,bottom color=SoftBlack] (-1,6) rectangle (8,0); \begin{axis}[axis lines=none] \addplot+[domain=0:2*pi,samples=37,mark=none, color=white] ({10*cos(10*deg(x)) + 1*cos(2*deg(x)) + 0.2*cos(deg(x)) + 0.1 * cos(0.5*deg(x))}, {10*sin(10*deg(x)) + 1*sin(2*deg(x)) + 0.2*sin(deg(x)) + 0.1 * sin(0.5*deg(x))}); \end{axis} \end{tikzpicture} \end{document}