• TeX for Baire category iterative sequence construction
    by 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?

  • 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 inverse
    by 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 loop
    by 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 added
    by 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 colors
    by 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 TikZ
    by 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}

  • How can I plot some datapoint stored in a CSV file in the Tensorboard style
    by galoischan on April 16, 2025 at 2:11 pm

    I stored some of the loss function curve as a CSV file and want to plot them in the way that Tensorboard plot them. But I have difficulty to realise two thing: plot the smoothened version of the curve show the entries with nan on the plot(maybe show each of the entries with nan as a red small triangle) THANK YOU A LOT This is the plot I get with the code I posted below: This is the plot how Tensorboard display the data(the original data is a little dimmer):(It is not a must to show the smoothened curve with the unsmoothened curve side by side, I just want a smoothened curve and a plot without skipping nan value at the end) the CSV file: run-.-tag-advg.csv some part of the CSV is posted here: Wall time,Step,Value 1727044803.2813585,55500,0.00949437078088522 1727045020.3863645,55550,0.010245434008538723 1727045240.331363,55600,0.009481625631451607 1727045463.5903947,55650,0.008838667534291744 1727045682.8413923,55700,0.008703619241714478 1727045899.1863914,55750,0.009342261590063572 1727046342.809394,55850,0.009162072092294693 1727046561.1233923,55900,0.00917676743119955 1727046779.3624206,55950,0.009618055075407028 1727046996.754392,56000,0.00986748468130827 1727047220.450394,56050,0.009403795003890991 1727047437.2354002,56100,0.008110546506941319 1727047656.1613934,56150,0.00843835063278675 1727048314.9193914,56300,0.008264702744781971 1727048533.4113946,56350,0.009781372733414173 1727048749.7403913,56400,0.009383087046444416 1727048969.5113904,56450,nan 1727049193.2183917,56500,nan 1727049412.4563947,56550,nan 1727049630.3143904,56600,nan 1727049851.3293905,56650,nan 1727050075.366392,56700,nan 1727050294.0353918,56750,nan The code is here: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{tikz} \usepackage{filecontents} \definecolor{tb_color_1}{RGB}{245,124,0} \definecolor{tb_color_2}{RGB}{0,167,247} \pgfplotscreateplotcyclelist{tb}{ semithick,tb_color_1\\% semithick,tb_color_2\\% } \begin{document} \centering \begin{tikzpicture} \begin{axis}[ cycle list name=tb, grid=both, grid style={solid,gray!30!white}, axis lines=middle, xlabel={step}, ylabel={adversarial loss of the generator (unitless)}, x label style={at={(axis description cs:0.5,-0.1)},anchor=north}, y label style={at={(axis description cs:-0.1,.5)},rotate=90,anchor=south}, ] \addplot table [x=Step, y=Value, col sep=comma] {run-.-tag-advg.csv}; \end{axis} \end{tikzpicture} \end{document}

  • Draw an hexagon in Tikz [duplicate]
    by Mohamed Diaf on April 15, 2025 at 11:24 am

    Can anyone draw for me this figure in Tikz ? That would be very helpful for me !

  • Export a figure in inkscape as tikz: the problem with a map
    by Angelo Aliano Filho on April 14, 2025 at 8:01 pm

    I have the following map of Brasil and its states: I would like to convert it using SVG2TikZ as in click here Another application is given in click here However, when I export my map to tikz in inkscape I have the options below: Then I generate the tikz code as in here: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \begin{document} \def \globalscale {1.000000} \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] \node[anchor=north west,inner sep=0, scale=\globalscale] (image1) at (2.0, 28.0) {\includegraphics[width=17.0cm,height=17.0cm]{data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAIBAQEBAQIBAQEC AgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBD AQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoK CgoKCgoKCgr/wgARCAfQB9ADAREAAhEBAxEB/8QAHQABAAIDAQEBAQAAAAAAAAAAAAgJBQYHBAMB Av/EABgBAQEBAQEAAAAAAAAAAAAAAAACAQME/9oADAMBAAIQAxAAAAGfwAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAORnkMwDcDPgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFTR ........ }}; \end{tikzpicture} \end{document} This is very strange because I don't have a path and the code does not compile. How can I fix this? Another question: there a way to I separate the states and give a name for each one?

  • TikZ edge starting location (when referencing node through variable)
    by Axe on April 14, 2025 at 7:42 pm

    \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \i in {1,...,24} { \node [draw] (n\i) at ({(\i-1-Mod(\i-1,4))/4},{Mod(\i-1,4)}) {\i}; } \foreach \i[evaluate=\i as \j using {\i+1}] in {1,...,23}{ \draw [->] (n\j) -- (n\i); } \end{tikzpicture} \end{document} The edges aren't behaving how I want. How can I make them behave like this, without sacrificing the loop? \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \i in {1,...,24} { \node [draw] (n\i) at ({(\i-1-Mod(\i-1,4))/4},{Mod(\i-1,4)}) {\i}; } \draw [->] (n2) -- (n1); \draw [->] (n3) -- (n2); \draw [->] (n4) -- (n3); \draw [->] (n5) -- (n4); \draw [->] (n6) -- (n5); \draw [->] (n7) -- (n6); \draw [->] (n8) -- (n7); \draw [->] (n9) -- (n8); \draw [->] (n10) -- (n9); \draw [->] (n11) -- (n10); \draw [->] (n12) -- (n11); \draw [->] (n13) -- (n12); \draw [->] (n14) -- (n13); \draw [->] (n15) -- (n14); \draw [->] (n16) -- (n15); \draw [->] (n17) -- (n16); \draw [->] (n18) -- (n17); \draw [->] (n19) -- (n18); \draw [->] (n20) -- (n19); \draw [->] (n21) -- (n20); \draw [->] (n22) -- (n21); \draw [->] (n23) -- (n22); \draw [->] (n24) -- (n23); \end{tikzpicture} \end{document}

  • Gap between pgfplots `plot`s
    by Mr.Hedge on April 13, 2025 at 2:18 pm

    I have the following code to draw a continuous function that is given by three different formulas: \documentclass[tikz, margin=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes, backgrounds, arrows.meta, fit} \usepackage[dvipsnames]{xcolor} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \pgfplotsset{compat=1.18} \input{Utils/Makra/Axis} \begin{document} \begin{tikzpicture}[ background grid/.style={thin, dotted, draw=gray,step=.5cm}, >=Stealth, remember picture, ] \newcommand{\filledPoints}{(4, 1)} \newcommand{\emptyPoints}{(-4, 3)} \Axis[ xmin=-4.5, xmax=4.99, ymin=-3.5, ymax=4.99, ]{% \path[name path=xaxis] (axis cs:-4, 0) -- (axis cs:4, 0); % Wykres funkcji \addplot [name path = A,domain=-4:-2, samples=2, thick, color=Red] {3}; \addplot [name path = B,domain=-2:2, samples=2, thick, color=Red] {-x+1}; \addplot [name path = C,domain=2:4, samples=2, thick, color=Red] {x-3}; \addplot [only marks, mark=*, mark size=1pt, color=red, on layer=axis foreground, % Rysuj na warstwie nad osiami ] coordinates {\filledPoints}; \addplot [only marks, mark=*, mark size=1pt, color=red, fill=white, on layer=axis foreground, % Rysuj na warstwie nad osiami ] coordinates {\emptyPoints}; \node[Red] at (axis cs:2,1) {$f(x)$}; %Domain \begin{pgfonlayer}{axis foreground} \draw[Green, thick] (axis cs:-4,0) -- (axis cs:4, 0); \addplot [only marks, mark=*, mark size=1pt, color=Green] coordinates {(4,0)}; \addplot [only marks, mark=*, mark size=1pt, color=Green, fill=white] coordinates {(-4,0)}; \addplot [Red, opacity=0.25] fill between [of = A and xaxis,soft clip={domain=-4:-2}]; \addplot [Red, opacity=0.25] fill between [of = B and xaxis,soft clip={domain=-2:2}]; \addplot [Red, opacity=0.25] fill between [of = C and xaxis,soft clip={domain=2:4}]; \end{pgfonlayer} \begin{pgfonlayer}{axis foreground} \node[rectangle, fill=Green!20, draw, rounded corners,on layer=axis foreground] at (axis cs:0, -3) {\textbf{$D_f=(-4,4]$}}; \end{pgfonlayer} } \end{tikzpicture} \end{document} The problem is that the edges of each plot are not connected and the below gap is present: How to fix it?

  • How can I draw this figure by drawing packages?
    by SandyM on April 13, 2025 at 10:22 am

    Que: How can I achieve the attached figure from my MWE? MWE: \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{calc,intersections,through,backgrounds} \usepackage{tkz-euclide} \usepackage{amsthm} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \tkzDefPoints{0/0/A,3/0/B,6/0/D,4.25/0/E} \tkzDefPoints{3/3/C} \tkzDrawSegments(A,D) \tkzDrawSegments(A,C) \tkzDrawSegments(B,C) \tkzDrawPoints(A,B,C,D,E) \tkzLabelPoints(A,B,C,D,E) \tkzDrawArc[style=dashed,color=red,](A,E)(C) \tkzDrawArc[style=dashed,rotate,color=red](A,E)(55) \tkzMarkRightAngle[fill=yellow!80,size=.35,draw](A,B,C) \end{tikzpicture}

  • How to Properly Colorize PDF Figures in LaTeX: Fill Color and Transparency Problems
    by 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.

  • 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.

  • Adapting the beameroutertheme to the beamerinnertheme
    by Snorlax on March 31, 2023 at 11:53 am

    It's about putting the finishing touches on my own beamer theme. I have more or less halfway managed to create a design for the beameroutertheme.sty, but it has shifted in comparison to the innertheme. I would like to have the spacing of the red bar and the logo aligned as it is on the front page (in terms of length). Unfortunately, any attempts to change it always destroy the design. Unfortunately, I have very little or hardly any experience with tikz and it is only thanks to the community here that I have come this far. \documentclass[10pt,% aspectratio=169,% ]{beamer} \usepackage {mwe} \usepackage{tikz} \usepackage{xcolor} \title{TITLE} \author{NAME} \institute{INSTITUT} \date{DATE} %\titlegraphic{\includegraphics[width=\paperwidth]{example-image-duck}} %beamertheme.sty \usetikzlibrary{shapes} \setbeamertemplate{navigation symbols}{} \setbeamertemplate{footline}{ \begin{beamercolorbox}[wd=\paperwidth, ht=2em, dp = 1em]{foot} \hspace*{1em} {\normalsize \inserttitle}\hfill{\normalsize \insertauthor, \insertdate} \hfill{\normalsize \insertpagenumber} \hspace*{1em} \end{beamercolorbox}} %beamercolortheme.sty \setbeamercolor*{author}{fg=white} \setbeamercolor*{date}{fg=white} \setbeamercolor*{structure}{fg=white} \setbeamercolor*{section in toc}{fg=gray} \setbeamercolor*{framtitle}{fg=white} \setbeamercolor*{section}{fg=white} \setbeamercolor*{normal text}{fg=gray} \setbeamercolor*{foot}{fg=gray,bg=white} \setbeamercolor*{title}{fg=white} \setbeamercolor*{title page header}{fg=white} %beamerinnertheme.sty \defbeamertemplate*{title page}{test}[1][] { \begin{tikzpicture}[remember picture,overlay] \node[fill=blue,minimum height=1cm,text width=\paperwidth] at ([yshift=2.5cm]current page.south) {\hspace{4cm}\usebeamerfont{title}\inserttitle}; \fill[color=green] (current page.south west) rectangle ++(2.95,1.9); \node[fill=red,minimum height=1.9cm,text width=\paperwidth-6.5cm] at ([yshift=0.95cm]current page.south) {\hspace{0.9cm}\usebeamerfont{author}\insertauthor\par\vskip0.1cm \hspace{0.9cm}\usebeamerfont{author}\insertdate}; \node[anchor=south east, inner sep =0.1cm] at (current page.south east) {\includegraphics[width=2.8cm]{example-image-b}}; \begin{scope} \clip ([yshift=3cm]current page.south west) rectangle (current page.north east); \ifx\inserttitlegraphic\empty% \node[anchor=south, inner sep=0cm] at ([yshift=3cm]current page.south) {\includegraphics[width=\paperwidth]{example-image-16x9}}; \else \node[inner sep=0cm] at ([yshift=1.5cm]current page.center) {\inserttitlegraphic}; \fi \end{scope} \end{tikzpicture} } %beameroutertheme.sty \defbeamertemplate*{frametitle}{test}[1][] { \begin{beamercolorbox}[wd=\paperwidth,ht=1.2cm]{frametitle} \begin{tikzpicture} \useasboundingbox[fill=white](0,0) rectangle(\the\paperwidth,1.2); \fill[color=green] (0,0) rectangle(2.95,1.1); %5.2 old \fill[color=red] (3.05,0) rectangle(\the\paperwidth-100,1.1); % \fill[red] (3.05,1.15) rectangle(\the\paperwidth,0.8); \ifx\insertframesubtitle\@empty% {\node at (\the\paperwidth-50,0.61){\includegraphics[width=2.8cm]{example-image-b}};% \node[anchor=west, white,font=\large] at (3.2,0.55){\insertframetitle};}% \else% {\node at (\the\paperwidth-50,0.61){\includegraphics[width=2.8cm]{example-image-b}};% \node[anchor= west, white,font=\large] at (3.2,0.75){\insertframetitle};% \node[anchor= west, white,font=\small] at (3.2,0.35){\insertframesubtitle};}% \fi \end{tikzpicture} \end{beamercolorbox} } \setbeamertemplate{headline}{% \leavevmode% \hbox{% \begin{beamercolorbox}[wd=\paperwidth,ht=5.2ex,dp=0.125ex]{palette}% \insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll} \end{beamercolorbox}% } } \setbeamertemplate{section in head/foot}{% \if\insertsectionheadnumber1 \tikz\node[draw=blue,fill=blue,shape=signal,very thick,text=white]{\insertsectionhead\hskip.3cm}; \else \tikz\node[draw=blue,fill=blue,shape=signal,signal from=west, signal to=east,very thick,text=white] {\insertsectionhead\hskip.3cm}; \fi } \setbeamertemplate{section in head/foot shaded}{% \if\insertsectionheadnumber1 \tikz\node[draw=blue,fill=white,shape=signal,very thick,text=blue]{\insertsectionhead\hskip.3cm}; \else \tikz\node[draw=blue,fill=white,shape=signal,signal from=west, signal to=east,very thick,text=blue] {\insertsectionhead\hskip.3cm}; \fi } %End of beameroutertheme \begin{document} \begin{frame}[plain] \titlepage \end{frame} \section{Sec 1} \begin{frame}{Title} \blindtext \end{frame} \section{Sec 2} \begin{frame}{Title 2} \framesubtitle{Subtitle} \blindtext \end{frame} \end{document}

  • Automatically adjust title image in beamer (beamerinnertheme.sty)
    by Snorlax on March 31, 2023 at 7:27 am

    I'm trying to create my own beamer theme and am failing at something probably simple. Unfortunately, I can't figure it out at all and hope that someone has a solution for me. As you can see from the title, it's about the cover image of a beamer theme that I want to create myself. In beamerinnertheme.sty I have already specified, with the help of the community here, that a default image is taken if no title image has been chosen. But now I would like to add to the code or have the option of selecting a title image in the presentation.tex file, which is automatically adapted to the frame and of course also to the selected aspectratio. In other words, in the presentation.tex e.g.. For example, the command: \titlepicture{file} and it automatically appears in the right place via innertheme. \documentclass[10pt,% aspectratio=1609,% ]{beamer} \usepackage {mwe} \usepackage{tikz} \usepackage{xcolor} \title{TITLE} \author{NAME} \institute{INSTITUT} \date{DATE} %\titlegraphic{example-image-a} %beamertheme.sty \setbeamertemplate{navigation symbols}{} %beamercolortheme.sty \setbeamercolor*{author}{fg=white} \setbeamercolor*{date}{fg=white} \setbeamercolor*{structure}{fg=white} \setbeamercolor*{section in toc}{fg=gray} \setbeamercolor*{framtitle}{fg=white} \setbeamercolor*{section}{fg=white} \setbeamercolor*{normal text}{fg=gray} \setbeamercolor*{foot}{fg=gray,bg=white} \setbeamercolor*{title}{fg=white} \setbeamercolor*{title page header}{fg=white} %beamerinnertheme.sty \defbeamertemplate*{title page}{test}[1][] { \begin{tikzpicture}[remember picture,overlay] \node[fill=blue,minimum height=1cm,text width=\paperwidth] at ([yshift=2.5cm]current page.south) {\hspace{4cm}\usebeamerfont{title}\inserttitle}; \fill[color=green] (current page.south west) rectangle ++(2.95,1.9); \node[fill=red,minimum height=1.9cm,text width=\paperwidth-6.5cm] at ([yshift=0.95cm]current page.south) {\hspace{0.9cm}\usebeamerfont{author}\insertauthor\par\vskip0.1cm \hspace{0.9cm}\usebeamerfont{author}\insertdate}; \node[anchor=south east, inner sep =0.1cm] at (current page.south east) {\includegraphics[width=2.8cm]{example-image-b}}; \ifx\inserttitlegraphic\empty% \node[anchor=south, inner sep=0cm] at ([yshift=3cm]current page.south) {\includegraphics[width=\paperwidth]{example-image-16x9}}; \fi \end{tikzpicture} } \begin{document} \begin{frame}[plain] \titlepage \end{frame} \section{Sec 1} \begin{frame}{Title} \blindtext \end{frame} \section{Sec 2} \begin{frame}{Title 2} \framesubtitle{Subtitle} \blindtext \end{frame} \end{document}

  • 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

  • Title image not over entire surface
    by Snorlax on March 30, 2023 at 9:39 am

    I'm trying to create my own beamer theme and am failing at something probably simple. Unfortunately, I can't figure it out at all and hope that someone has a solution for me. As you can see from the topic, I would like to implement a standard image in the beamerinnertheme.sty. So far I have managed to load a standard image. The problem is that it does not cover the entire free white space but leaves a large white bar. Where in my code should I set it so that the image can go over the entire surface? I would also like to note the different aspectratio in this. beamerinnertheme.sty: \documentclass[% aspectratio=169,% ]{beamer} \usepackage {mwe} \usepackage{tikz} \usepackage{xcolor} \title{TITLE} \author{NAME} \institute{INSTITUT} \date{DATE} % Content from the beamertheme.sty \setbeamertemplate{navigation symbols}{} % Content from the beamerinnertheme.sty \setbeamertemplate{background} { \begin{tikzpicture} \useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight); \fill[color=blue] (0,2) rectangle (\the\paperwidth,\the\paperheight-175); \fill[color=green] (0,0) rectangle(2.95,1.9); \fill[color=red] (3.05,0) rectangle(\the\paperwidth-100,1.9); \node[anchor=south east, inner sep =0pt] at (\the\paperwidth-0.5cm,0.5cm) {\includegraphics[width=2.8cm]{example-image-b}}; \ifx\inserttitlegraphic\empty% \node[anchor=south, inner sep=0pt] at (current page.center) {\includegraphics[width=\paperwidth,height=\paperheight]{example-image-16x9}}; \fi \ifnum\thepage>1\relax% \fill[white,opacity=1] (0,0) rectangle(\the\paperwidth,\the\paperheight); \fi \end{tikzpicture} } \defbeamertemplate*{title page}{test}[1][] { \vskip6cm% \begin{beamercolorbox}[wd=12cm,leftskip=3cm,sep=8pt,#1]{title page header} \usebeamerfont{title}\inserttitle\par% \end{beamercolorbox}% \vskip0.5cm%75 \begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{author} \usebeamerfont{author}\insertauthor% \end{beamercolorbox} \vskip0.2cm% \begin{beamercolorbox}[wd=12cm,leftskip=3cm,#1]{date} \usebeamerfont{author}\insertdate% \end{beamercolorbox} \vfill } \begin{document} \begin{frame}[plain] \titlepage \end{frame} \begin{frame}{Title} \blindtext \end{frame} \end{document}

  • Remove Zero as Chapter Number in Header Using scrlayer-scrpage
    by 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.

  • Tikz text in Nodes
    by John on August 14, 2019 at 1:17 pm

    I found the following code for the representation of a Neural Network in another thread: \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix,chains,positioning,decorations.pathreplacing,arrows} \begin{document} \begin{tikzpicture}[ plain/.style={ draw=none, circle, inner sep=2pt, font=\Huge, join = by -latex }, net/.style={ matrix of nodes, nodes={ draw, circle, inner sep=10pt }, nodes in empty cells, column sep=2cm, row sep=-9pt }, >=latex ] \matrix[net] (mat) { |[plain]| \parbox{1.3cm}{\centering Input\\layer} & |[plain]| \parbox{1.3cm}{\centering Hidden\\layer} & |[plain]| \parbox{1.3cm}{\centering Output\\layer} \\ & |[plain]| \\ |[plain]| & \\ & |[plain]| \\ |[plain]| & |[plain]| \\ & & \\ |[plain]| & |[plain]| \\ & |[plain]| \\ |[plain]| & \\ & |[plain]| \\ }; \foreach \ai [count=\mi ]in {2,4,...,10} \draw[<-] (mat-\ai-1) -- node[above] {Input \mi} +(-2cm,0); \foreach \ai in {2,4,...,10} {\foreach \aii in {3,6,9} \draw[->] (mat-\ai-1) -- (mat-\aii-2) ; } \foreach \ai in {3,6,9} \draw[->] (mat-\ai-2) -- (mat-6-3); \draw[->] (mat-6-3) -- node[above] {Output} +(2cm,0); \end{tikzpicture} \end{document} The picture looks as follows: I was wondering whether it is possible to write text within the nodes themselves. For instance, in the first column of nodes, I would like to put $z_{1}$, $z_{2}$, etc..

  • 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 Tikz
    by 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?

  • Beamer boxes with flat shadows
    by Hendrik on November 25, 2015 at 9:56 am

    Is there a possibility to change the 'faded out' shadows from beamer boxes to 'flat shadows'? With flat shadow I am referring to a shadow of a single color without a gradient. Ideally, I would like to have an opaque drop shadow in the style of the tikz.shadows library. It can be used as follows to add a flat shadow to a node: \node[draw,drop shadow={opacity=.25, shadow xshift=0.07, shadow yshift=-0.07, color=green}] at (0,0) {node with green shadow}; This is my MWE beamer document containing a single box with a fading shadow: \documentclass{beamer} \setbeamertemplate{blocks}[rounded][shadow=true] % use rounded blocks with standard beamer shadow \begin{document} \begin{frame}{Example frame} \begin{block}{Block with shadow} I, box, have a gradient shadow but I want a flat shadow. \end{block} \end{frame} \end{document} The definition of the box shadows is most certainly contained in beamerbasedboxes.sty of the beamer package. Unfortunately, I do not understand the code since it mostly uses low level pgf commands instead of tikz commands. So far, I have tried to modify several commands in this file, but without success. Or maybe I have simply overlooked an option of the blocks template?

  • Tikz: setting options for pin
    by Jason S on May 13, 2015 at 8:44 pm

    I just found the pin option to drawing, and it looks useful in some of the things I want to draw. How do I format it though? I've tried pin=[red]60:{Hey!} and I get the error Cannot parse this coordinate. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes,arrows,positioning} \begin{document} \begin{tikzpicture}[node distance=2cm,>=latex, every node/.style={ font=\sffamily\scriptsize }, circtext/.style={draw,circle,minimum size=8pt,inner sep=2pt}, dot/.style={draw,circle,fill=black,minimum size=0.6mm,inner sep=0pt} ] { \node[rectangle, fill=green!10!white!90!black, minimum width=6cm, minimum height=3cm] at (2,0){}; \node[circtext, fill=yellow](A) at (0,0) {A}; \node[circtext, fill=yellow, right=of A](B){B}; \draw[->] (A) -- node[dot, pos=0.5, pin=[red]60:{Hey!}](C){}(B); } \end{tikzpicture} \end{document} The default style looks like it's a gray thin arrow, and I want to change it to a black thin dotted line with no arrow. update: I figured out how to add style to the pin node: pin={[red]60:Hey!}] But I can't figure out how to change the linestyle though.

  • Plotting a distribution with tikz package
    by Colenso on October 8, 2014 at 7:30 am

    I'm trying to generate a plot of a censored Gamma distribution. I've managed to make the plot of the Gamma-pdf and reference the censoring point, but I'm failing to suppress anything beyond it. In other words, after the censoring point n-star there should be no distribution diagram. My strategy was to try to fill the distribution's plot beyond n-star in white. I made the filling border thick and while it helped it didn't get the job done (you can still see a thin line beyond n-star). I'm attaching an image of the generated plot and also pasting the code. I would appreciate any ideas that could solve this problem. Many thanks! \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[ declare function={gamma(\z)= 2.506628274631*sqrt(1/\z)+ 0.20888568*(1/\z)^(1.5)+ 0.00870357*(1/\z)^(2.5)- (174.2106599*(1/\z)^(3.5))/25920- (715.6423511*(1/\z)^(4.5))/1244160)*exp((-ln(1/\z)-1)*\z;}, declare function={gammapdf(\x,\k,\theta) = 1/(\theta^\k)*1/(gamma(\k))*\x^(\k-1)*exp(-\x/\theta);} ] \begin{axis}[ no markers, domain=0:9, samples=100, axis lines=left, xlabel=$n_t^i$, ylabel=$f_n(.)$, every axis y label/.style={at=(current axis.above origin),anchor=east}, every axis x label/.style={at=(current axis.right of origin),anchor=north}, height=5cm, width=9cm, xtick={6.0}, ytick=\empty, xticklabels={$n^*$}, %xticklabels={$\bar n (\theta_t)$}, enlargelimits=false, clip=false, axis on top, grid = major ] \addplot [very thick,cyan!20!black,domain=0:20] {gammapdf(x,2,2)}; \addplot [fill=cyan!20, draw=none, domain=0:6.0] {gammapdf(x,2,2)} \closedcycle; \addplot [very thick, fill=white!20!white, draw=none, domain=6.01:20] {gammapdf(x,2,2)} \closedcycle; \end{axis} \end{tikzpicture} \end{document}

  • How to draw/annotate with TikZ on molecules drawn with chemfig package?
    by doctorate on September 30, 2013 at 4:13 pm

    I have just discovered the TikZ spin-off chemfig package for chemistry drawings. I just wanted to add some transparent box to highlight a certain region of the drawn molecule with some text using relative nodes with TikZ. The relativity is needed so that to keep everything in one piece when rotated. For this reason the molecule was drawn with relative angles instead of absolute ones. Another request, is how can I put large brackets instead of the shaded box idea, I mean just to put the shaded area in between two large brackets? What I want looks like this image below: Code for chemfig: \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} \usepackage{chemfig} \begin{document} \setatomsep{2em} \chemfig{[:-30]*5(-(=O)-N(-O-[::60]([::-60]--[::60]--[::60]--[::60]-(=[::-60]O)-[::60]O-#(,7pt)[::-60]*5(N-(=O)---(=O)-#(0,5pt)) )=[::60]O)-(=O)--)} \end{document}

  • Footline placement after \begin{document}
    by Alok on November 8, 2011 at 5:34 pm

    I'm trying to place an image as a border in the footer (footline) of a beamer presentation. I've noticed that if I use \setbeamertemplate{footline}[large] after the \begin{document}, the vertical placement is too low to show the image. If I use it before \begin{document}, then it gets placed correctly. In the final presentation, some slides (such as the title slide) will have this, but more will not, which is why I don't want to set it globally above \begin{document} and then suppress it on the slides which don't have it. What I'm trying to do would look like: \defbeamertheme{footline}{large}{ \leavevmode \includegraphics[width=\paperwidth]{images/banner.pdf} \begin{tikzpicture}[overlay] \node at (-.845\paperwidth,.05\paperheight) { \includegraphics[width=.15\paperwidth]{images/logo.png} }; \end{tikzpicture} } \begin{document} {\setbeamertemplate{footline}[large] \begin{frame} \titlepage \end{frame} } \begin{frame}{Frame without footline} Text \end{frame} \end{document}