• Necesessarily high-sampled curve in plain TikZ
    by Jasper on July 28, 2026 at 6:34 am

    I was making a rational double pendulum in Asymptote: // a rational double pendulum import graph; unitsize(3cm); pair truncated_pi(real t) { real t1 = 3.14 * t; return ( cos(t) + cos(t1), sin(t) + sin(t1) ); } path f = graph(truncated_pi, 0, 314, n=10000); draw(f); I wanted to make it in TikZ, but I am running into the issue of needing a number of samples which is beyond the limit imposed by pgfmath. As some of you may be familiar with, I am very fond of plain TikZ. I would like to see if there are ways to achieve this which are not overly ad hoc. For example, one strategy would be to break the domain into separate regions. How would one draw something like this in the spirit of plain TikZ? \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw[ domain=0:314, samples=10000, trig format=rad, declare function={ t1(\x) = 3.14 * \x; x(\x) = cos(\x) + cos(t1(\x)); y(\x) = sin(\x) + sin(t1(\x)); } ] plot ({x(\x)},{y(\x)}); \end{tikzpicture} \end{document}

  • Draw custom listings caption with tikz over the background
    by umarcor on July 27, 2026 at 3:21 pm

    I'm trying to customise listings captions using tikz, but the background of the code listing is drawn afterwards, covering the tikz caption. How can I ensure the caption to be drawn after/over the code? This is what I want to achieve: The Minimal Working Example (MWE) below shows where I got so far. In the orange examples (adding 4ex before and -5ex after) the tikz picture is properly aligned with the frame/background of the code; however, it's drawn below. Moreover, the vertical space between the previous text and the listing is the same in the cyan and red examples, but it's slightly increased in the orange examples, which I don't understand. On the other hand, the magenta examples use just -1ex before (no forced vertical spacing after) and are properly aligned with the frame/background of the code; but they require several \noparskip to avoid excessive vertical space from the previous text/title, which I neither understand. \documentclass[twoside,openright,11pt]{report} \usepackage[a4paper,margin=2cm]{geometry} \usepackage{filecontents} \edef\restoreparindent{\parindent=\the\parindent\relax} \RequirePackage{parskip} \restoreparindent \newcommand*{\noparskip}{\par\vspace{-\parskip}} \usepackage{fontawesome} \usepackage[dvipsnames,table]{xcolor} \usepackage{tikzpagenodes} % Loads tikz \usetikzlibrary{calc} \usepackage{caption} \usepackage{listings} \lstset{ language=C, basicstyle=\ttfamily, backgroundcolor=\color{gray!5}, frame=single, framerule=0pt, framesep=1ex, xleftmargin=1ex, xrightmargin=1ex, } \captionsetup[lstlisting]{ font={footnotesize,bf}, justification=raggedleft, singlelinecheck=false } \newcommand*\lstc[1]{\noparskip\lstinputlisting[firstline=5, caption = \faFileCodeO~\lstname]{#1}} \DeclareCaptionFormat{rulebox}{% \parbox{\linewidth}{% \makebox[\linewidth]{% \leaders\hrule height 0.5pt\hfill~#1#2#3% }% }% } \DeclareCaptionFormat{tikzrule}{% \begin{tikzpicture}[remember picture, overlay] \node[blue, anchor=east] (P) {#1#2#3}; \draw[blue] (current page text area.west|-0,0) -- (P); \end{tikzpicture} } \DeclareCaptionFormat{tikzrulebox}{% \begin{tikzpicture}[remember picture, overlay] \node[green, draw, anchor=north east] (P) {#1#2#3}; \draw[green] (current page text area.west|-0,0) -- (P.north west); \end{tikzpicture}% } \DeclareCaptionFormat{tikzruleboxpoff}{% \vspace*{4ex} \begin{tikzpicture}[remember picture, overlay] \node[cyan, draw, anchor=north east] (P) {#1#2#3}; \draw[cyan] (current page text area.west|-0,0) -- (P.north west); \end{tikzpicture}% } \DeclareCaptionFormat{tikzruleboxpoffn}{% \vspace*{4ex} \begin{tikzpicture}[remember picture, overlay] \node[red, draw, anchor=north east] (P) {#1#2#3}; \draw[red] (current page text area.west|-0,0) -- (P.north west); \end{tikzpicture}% \vspace*{-4ex} } \DeclareCaptionFormat{tikzruleboxpoffnd}{% \vspace*{4ex} \begin{tikzpicture}[remember picture, overlay] \node[orange, draw, anchor=north east] (P) {#1#2#3}; \draw[orange] (current page text area.west|-0,0) -- (P.north west); \end{tikzpicture}% \vspace*{-5ex} } \DeclareCaptionFormat{tikzruleboxnoff}{% \vspace{-1ex} \begin{tikzpicture}[remember picture, overlay] \node[magenta, draw, anchor=north east] (P) {#1#2#3}; \draw[magenta] (current page text area.west|-0,0) -- (P.north west); \end{tikzpicture}% } \begin{filecontents}{main.c} #include <stdio.h> #include <stdlib.h> int main () { printf("Hello!\n"); return 0; } \end{filecontents} \begin{document} \hrule \section*{Section title} \hrule \captionsetup[lstlisting]{format=rulebox} \lstc{main.c} \vspace*{5ex} \captionsetup[lstlisting]{format=tikzrule} \hrule TikZ Rule \hrule \lstc{main.c} \vspace*{5ex} \captionsetup[lstlisting]{format=tikzrulebox} \hrule TikZ Rule Box \hrule \lstc{main.c} \vspace*{5ex} \captionsetup[lstlisting]{format=tikzruleboxpoff} \hrule 4ex TikZ Rule Box \hrule \lstc{main.c} \vspace*{5ex} \captionsetup[lstlisting]{format=tikzruleboxpoffn} \hrule 4ex TikZ Rule Box -4ex (with rule) \hrule \lstc{main.c} \hrule 4ex TikZ Rule Box -4ex (no rule) \noparskip% \lstc{main.c} \newpage \captionsetup[lstlisting]{format=tikzruleboxpoffnd} \hrule 4ex TikZ Rule Box -5ex (with rule) \hrule \lstc{main.c} \hrule 4ex TikZ Rule Box -5ex (no rule) \noparskip% \lstc{main.c} \vspace*{5ex} \captionsetup[lstlisting]{format=tikzruleboxnoff} \hrule TikZ Rule Box N off (with hrule) \hrule \noparskip% \lstc{main.c} \hrule TikZ Rule Box N off (no hrule) \noparskip% \noparskip% \lstc{main.c} \end{document} EDIT Applying the solution proposed by @kabenyuk below, it works nicely except if the lstlisting needs to be located at the top of a page. In such case, the caption is put at the top of the current page and the code at the top of the next one. \documentclass{report} \usepackage{filecontents} \usepackage{lipsum} \usepackage{xcolor} \usepackage{tikzpagenodes} % Loads tikz \usetikzlibrary{calc} \usepackage{caption} \usepackage{listings} \lstset{ language=C, backgroundcolor=\color{gray!5}, } \newcommand*\lstc[1]{\lstinputlisting[caption = \lstname]{#1}} %% Deferred drawing of TikZ captions \makeatletter % A number unique to each TikZ caption. \newcount\lstcaption@id % Store the caption contents and mark its position. \newcommand*{\lstcaption@store}[1]{% \global\advance\lstcaption@id\@ne \edef\lstcaption@thisid{\the\lstcaption@id}% % Create a separate box for each caption, since one page may contain several listings. \expandafter\newsavebox \csname lstcaption@box@\lstcaption@thisid\endcsname \global\setbox \csname lstcaption@box@\lstcaption@thisid\endcsname = \hbox{#1}% % Only the coordinate is placed here. The actual drawing will be produced later. \begin{tikzpicture}[remember picture,overlay] \coordinate (lstcaption@pos@\lstcaption@thisid) at (0,0); \end{tikzpicture}% } \newcommand*{\lstcaption@draw}[1]{% \begin{tikzpicture}[remember picture,overlay] \node[draw, opacity=.75, anchor=north east] (P) at (lstcaption@pos@#1) {\copy\csname lstcaption@box@#1\endcsname}; \draw[opacity=.75] (current page text area.west|-P.north west) -- (P.north west); \end{tikzpicture}% } \DeclareCaptionFormat{tikzrulebox}{% % Store a caption and schedule it to be drawn in the foreground layer of the page. \lstcaption@store{#1#2#3}% \edef\lstcaption@tmp{% \noexpand\AddToHookNext{shipout/foreground}{% \noexpand\lstcaption@draw{\lstcaption@thisid}% }% }% \lstcaption@tmp } \makeatother \captionsetup[lstlisting]{ format=tikzrulebox, justification=raggedleft, singlelinecheck=false, aboveskip=-1ex, } \begin{filecontents}{main.c} #include <stdio.h> #include <stdlib.h> int main () { printf("Hello!\n"); return 0; } \end{filecontents} \begin{filecontents}{another.c} #include <stdio.h> int main () { printf("Bye!\n"); } \end{filecontents} \begin{document} \section*{Section title} \lstc{main.c} This is some regular text. \lstc{main.c} \lipsum[1-2] \lipsum[1][1-5] \lstc{another.c} \end{document}

  • Keep track of the number of chapters in each part
    by umarcor on July 26, 2026 at 2:48 pm

    In the following Minimal Working Example (MWE), I'd like to keep track of the totvalue of chapcnt within each part (since chapcnt is set to 0 at the beginning of each part). Currently, \totvalue{chapcnt} returns the number of chapters in the last part (the maximum after it is last reset in the document). \documentclass[twoside]{report} \let\latexthesection\thesection \renewcommand*{\thesection}{\arabic{section}} \usepackage{titlesec} \titleclass{\part}{top} \titleformat{\part}{\Huge\bfseries\color{blue}}{\thepart}{10pt}{} \titleclass{\chapter}{top} \titleformat{\chapter}{\Huge\bfseries\color{green}}{\thechapter}{10pt}{} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{totcount, eso-pic, xifthen} \regtotcounter{partcnt} \newcounter{partcnt} \regtotcounter{chapcnt} \newcounter{chapcnt} \AddToShipoutPictureBG{% \begin{tikzpicture}[overlay] \ifthenelse{\isodd{\value{page}}}% {\def\corner{east}\def\sign{-}}% {\def\corner{west}\def\sign{+}} \pgfmathsetlengthmacro{\parttabheight}{\paperheight/\totvalue{partcnt}} \pgfmathsetlengthmacro{\parttaboffset}{(\thepartcnt-1)*\parttabheight} \fill[blue] ($(current page.north \corner)+(0,-\parttaboffset)$) rectangle ++(\sign.40,-\parttabheight); % FIXME Chapters should be counted within the part, thus keeping one chapter totvalue per part to adjust the chaptabheight in each part. \ifthenelse{\thechapcnt>0} { \pgfmathsetlengthmacro{\chaptabheight}{\parttabheight/\totvalue{chapcnt}} \pgfmathsetlengthmacro{\chaptaboffset}{(\thechapcnt-1)*\chaptabheight} \fill[green] ($(current page.north \corner)+(\sign.20,-\parttaboffset-\chaptaboffset)$)% rectangle ++(\sign.40,-\chaptabheight); }{} \end{tikzpicture} } \newcommand*{\unpart}[1]{ \part*{#1} \stepcounter{partcnt} \setcounter{chapter}{0} \setcounter{chapcnt}{0} \thepartcnt~\thechapcnt } \newcommand*{\unchapter}[1]{ \chapter*{#1} \stepcounter{chapcnt} \thepartcnt~\thechapcnt } \begin{document} \unpart{FirstPart} \unchapter{P1:FirstUNChapter} \section{A Numbered Section} \section{Another Numbered Section} \unchapter{P1:SecondUNChapter} \chapter{P1:ThirdNChapter} \stepcounter{chapcnt} \thepartcnt~\thechapcnt \unchapter{P1:LastUNChapter} \unpart{SecondPart} \unchapter{P2:FirstUNChapter} \unchapter{P2:SecondUNChapter} \unchapter{P2:ThirdUNChapter} \end{document} In the fourth page below the green rectangle is drawn outside of the blue rectangle because it's using 3 as the total number of chapters. The last part hast 3 chapters but the first one has 4. The chaptabheight of the chapters in the first part should be computed using 4, and the chaptabheight of the chapters in the second part should be computed using 3.

  • Marginnote does not work [duplicate]
    by Rassine Orange on July 26, 2026 at 12:47 pm

    When I try to put a tikzpicture inside a marginnote, I get this error: Equations.tex: error: 132: Argument of \pgfplots@addplotimpl@expression has an extra }. I guess there may be a conflict with another package/options as when I try a MWE with just the marginote, it works, see below. I cannot paste here my whole preambule as it would be too long. What could a possible source of this error? (For context I'm trying to get something similar as can be seen in this discussion. Sadly the code is nowhere to be found in the discussion...) \documentclass[a4paper,11pt]{article} \usepackage[top=2cm,bottom=2cm,right=4cm,left=2cm,marginparsep=0.5cm]{geometry} \usepackage{marginnote} %%%Tikz \usepackage{tikz} \usepackage{pgfplots} \begin{document} A marginote, all good \marginnote{ \begin{tikzpicture} %[x=1cm,y=1cm,auto,rotate=90,transform shape] \begin{axis}[ width=4.5cm, height=3cm, % hauteur xmin=-2, xmax=10, ymin=0, ymax=12, xtick= \empty, ytick= \empty, extra x ticks = {0,2}, extra x tick style={tick style={draw=none}}, extra y ticks = {2, 8,10}, extra tick style={tick style={draw=none}}, axis line style={thick, shorten >=-20pt, shorten <=0pt}, %extra x tick labels={0,0.5,...,10}, %grid style={very thin, dotted, color=gray}, grid=none, % grille verticale et horizontale axis x line=center, axis y line=center, ylabel=$x(t)$, ylabel style={anchor=south,yshift = 0.75cm}, xlabel=$t$, xlabel style={anchor=west,xshift = 0.75cm}, axis line style={>=stealth,->}, ] \addplot+[domain=0:10,color=cyan, thick, smooth,samples=400,mark=none] (\x,{4/(1+5^(-2*\x))}); \addplot+[only marks,mark = *, cyan, mark options={fill=white} ] coordinates { (2,5) (0,4)}; \draw [dashed, cyan] (axis cs:{2,0}) -- (axis cs:{2,5}) -- (axis cs:{0,5}); \draw [dashed, orange] (axis cs:{0,10}) -- (axis cs:{10,10}); \end{axis} \end{tikzpicture}} But does not work \end{document} Edit: The solution was here, the key was to use \shorthandoff. I'm not sure why and what this command does though, so the solution may not be robust.

  • Use inner and outer margins implicitly in tikz when defining a custom section titleformat for a twoside report
    by umarcor on July 26, 2026 at 12:29 pm

    In the following Minimal Working Example (MWE), the section and subsection title formats are modified using titlesec's titleformat along with tikz. In order to handle odd and even pages, command sectitleformat receives arguments #6 and #7, which are {\innermargin}{\outermargin} for odd pages and {\outermargin}{\innermargin} for even pages. Is it possible to avoid defining and using \innermargin and \outermargin, and instead know/compute those margins using tikz's calc/positioning without explicitly passing those two arguments to sectitleformat? So, instead of using sectitleformat four times, I'd like to use it twice only (\sectitleformat[]... and \sectitleformat[numberless]...). \documentclass[twoside,openright,11pt]{report} \usepackage{geometry} \geometry{ showframe, a4paper, hmargin=18mm, bindingoffset=5mm, } \def\innermargin{\dimexpr\oddsidemargin+1in} \def\outermargin{\dimexpr\evensidemargin+1in\relax} \usepackage{MnSymbol} \usepackage{tikz} \usetikzlibrary{calc} \usepackage[explicit]{titlesec} \newcommand*\sectitleformat[7][]{ \titleformat{name=#2, page=#1}{\large\bfseries}{}{0pt}{ \begin{tikzpicture}[remember picture, overlay] \draw[draw=blue, thick] ($(current page.west|-0,0)+(#6,0)$) -- ++(#4,0) node [anchor=west] (S) {#3##1}; \draw[blue, thick] (S) -- ($(current page.east|-0,0)+(-#7,0)$); \end{tikzpicture} } } \newcommand*\sectitleformats[4]{ \sectitleformat[odd]{#1}{#2~$\filleddiamond$~}{#3}{#4}{\innermargin}{\outermargin} \sectitleformat[odd, numberless]{#1}{}{#3}{#4}{\innermargin}{\outermargin} \sectitleformat[even]{#1}{#2~$\filleddiamond$~}{#3}{#4}{\outermargin}{\innermargin} \sectitleformat[even, numberless]{#1}{}{#3}{#4}{\outermargin}{\innermargin} } \sectitleformats{\section}{\thesection}{.5cm}{fill} \sectitleformats{\subsection}{\thesubsection}{.75cm}{fill} \begin{document} \section{Numbered sec} \subsection{Numbered subsec} \section*{Numberless sec} \subsection*{Numberless subsec} \newpage \section{Another Numbered sec} \subsection{Another Numbered subsec} \section*{Another Numberless sec} \subsection*{Another Numberless subsec} \end{document}

  • Is there a built-in mechanism in plain TikZ to cache intermediate calculations locally within a plot expression?
    by Jasper on July 25, 2026 at 5:35 am

    Is there a built-in mechanism in plain TikZ to cache intermediate calculations locally within a plot expression? I mean I could just use a foreach loop and pgfmathsetmacro, but that's quite intensive. Is this built in to plot? If not, should/could it be? \documentclass{article} \usepackage{tikz} \begin{document} \tikz \draw[domain=0:1] plot ( \x, { (\x-2)^2 % there is an (\x-2) term here - (\x-2)^3 % and it is duplicated here } ) ; \end{document}

  • tkz-euclide: Ignore undrawn points for bounding box
    by Nick A. on July 24, 2026 at 1:34 pm

    I'm using tkz-euclide to draw the following diagram, which is not properly centered: \documentclass{article} \usepackage{tikz} \usepackage{tkz-euclide} \begin{document} \begin{tikzpicture} \tkzDefPoints{0/0/A, 5/0/B} \tkzCalcLength(A,B) \tkzGetLength{dAB} \tkzDefCircle[R](A, 0.4*\dAB) \tkzGetPoint{P1} \tkzInterLC(A,B)(A,P1) \tkzGetPoints{}{C} \tkzDefCircle[R](B, 0.4*\dAB) \tkzGetPoint{P2} \tkzInterLC(A,B)(B,P2) \tkzGetPoints{D}{} \tkzInterCC(A,C)(C,A) \tkzGetPoints{E}{} \tkzInterCC(D,B)(B,D) \tkzGetPoints{F}{} \tkzInterLL(A,E)(B,F) \tkzGetPoint{G} \tkzDrawSegment[thick](A,B) \tkzDrawArc[gray, delta=10](A,C)(E) \tkzDrawArc[gray, delta=10](B,F)(D) \tkzDrawArc[gray, delta=10](C,E)(A) \tkzDrawArc[gray, delta=10](D,B)(F) \tkzDrawSegments[gray, add=0 and .1](A,G B,G) \tkzDrawSegments[thick, blue](A,G B,G) \tkzLabelPoint[below left](A){$A$} \tkzLabelPoint[below right](B){$B$} \tkzLabelPoint[below left](C){$C$} \tkzLabelPoint[below right](D){$D$} \tkzLabelPoint[above left](E){$E$} \tkzLabelPoint[above right](F){$F$} \tkzLabelPoint[above](G){$G$} % \tkzDrawPoints(P2) % \draw[red] (current bounding box.south west) rectangle (current bounding box.north east); \end{tikzpicture} \end{document} Uncommenting the code at the bottom shows the issue is with the point P2: It's only used for calculation and not drawn, but the bounding box is drawn to include it anyway, pushing the diagram left. Is there a way to instruct tikz to ignore this point so the diagram is centered appropriately? Is there a better way to use tkz-euclide to avoid this issue?

  • Fine-tuning the box surrounding a bar plot
    by Muhannad Al Ayoubi on July 18, 2026 at 5:22 pm

    This is my first time making a bar plot using pgfplots. I am happy so far with what I have, but I still need some points. How can I make the top-most tick (14) coincide with the top boundary of the box? I do not like the tiny space between the top-most gridline and the top boundary of the box. I've already tried removing 14 from the key ytick but I don't like the result. I think the 14 has to stay. Suppose instead I decided to completely remove the top and right boundaries of the box. I know I can do that using the options axis x line*=bottom and axis y line*=left, but then I'd like to include arrowheads, at least for the y-axis. How to do that? Finally, I've managed to adjust the distance between successive bars by playing with the option x=0.8 cm. Is there a better way? Here is my code. I've also attached the figure. \documentclass[10pt]{book} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture}[every node/.style={font=\footnotesize}] \begin{axis}[ clip=false, ybar, ymajorgrids, grid style={dashed}, ymin=0, %axis x line*=bottom, %axis y line*=left, xlabel=Number of siblings, ylabel=Frequency, ytick pos=left, xtick pos=left, xtick=data, ytick={0,2,4,...,12,14}, bar width=.4cm, x=0.8cm, y=0.3cm, label style={font={\footnotesize \itshape}}, tick label style={font={\footnotesize \itshape}}, nodes near coords, nodes near coords align={vertical}, ] \addplot [fill=orange,] coordinates { (0,3) (1,13) (2,8) (3,3) (4,1) }; \end{axis} \end{tikzpicture} \end{document}

  • Adjusting TikZ code example to create clock faces for modular arithmetic graphics
    by Bryan-StackExchange on July 18, 2026 at 4:30 pm

    The following Stack Exchange answers describe two sort of clock faces which are very close to what I need : Chords between nodes on a clock-like diagram using TikZ As seen in the two examples, I would like to : keep the digits on exterior of circle control whether to display the arrows or lines - or, especially, not display them. I have been able to adjust the code of the two answers (details below) in order to : increase the divisions e.g. from 12 to 98 (but see below) obtain any single face and print it using most of size 8.5 x 11 paper I still would like : display only certain values around perimeter - e.g. 12, 3, 6, 9 as might be seen on a normal clock increase the total to 98 but ideally any value. The purpose is generally for looking at symmetry in modular arithmetic. LaTeX seems ideally suited for this vs. e.g. Gnuplot. omit the lines between "nodes" (or markings) potentially create hash marks on the circle at any increment I do not understand many parts of the two code examples, and I believe this is necessary to adjust the examples to my requirements. e.g. the function of modtweleve and TikZMGClockMath. I am using https://tikz.dev/ as a reference - so I suspect I am overlooking a number of resources. The small adjustments to the two answers in the link are IMHO trivial, and I do not think they need to be reproduced here unless requested. some details : in the accepted answer by user Jake, in \newcommand replace 12 with e.g. 50. However, this approach runs into memory problems as the value increases. adjust stepsize in {1,...,12} to e.g. stepsize in {5} gives the fifth clock face only. This is good. in the answer by user percusse I adjusted 12 to 13 and used a single \begin{scope} to control how many pictures are displayed. The resultant image(s) are closest to what I need ; however, I do not understand how the macro is working - e.g. the \modtwelve part. However, the value can be increased to 98 without any memory problems, and create a nice image. In fact, my exact goal is met by adjusting \TikZMGClockMath{3}{28} - giving a 7-fold pattern. Specifically, the drawing would be perfect if the integers between e.g. 0 and 28 were omitted. in that answer, I commented out line 19-29 - from \draw and the first } that appears - to 'omit' the lines (vectors). This seems good. UPDATE: I added hashmarks with this code: \foreach \angle / \label in {90/0, 38.6/14, -12.8/28, -64.2/42, -115.6/56, -167/70, -218.4/84} ... which is good to show 7-fold symmetry, but they are not on the perimeter. The \draw commands adjust the position of a node or line width by the \angle. This is easy to adjust. See https://tikz.dev/pgffor UPDATE I found an inelegant way to add hashmarks - right after the above code, put this in: \draw[line width=0.5pt] (\angle:8.0cm) -- (\angle:8.5cm); } \foreach \angle in {86.3265, 86.3265, 82.6531, [.. skipping...] -258.98, -262.653, -266.327} the values are pre-calculated using awk. It would be nice to reduce that into a \foreach, multiplying the value of the example (360/98). Then, (360/98) could be any division of the circle. I tried asking on the original post, but I do not have the requisite reputation. If there is a better approach, I'd be glad to change this question.

  • An original cover of my book for a broken clock
    by Sebastiano on July 17, 2026 at 8:21 pm

    I have tried to create a cover for my book that is beautiful and visually appealing. Since the book deals with topics such as relativity, clocks, four-vectors, spacetime, the calculus of variations, and many other fascinating ideas, I imagined clocks being sucked into an unknown spacetime and deformed in the style of Salvador Dalí. The clocks become distorted until they break apart into many fragments, including the smallest and most symbolic components, such as the central pin and the internal spring. Question: How can you improve the broken clock that loses pieces to make it look more beautiful? \documentclass[12pt,a4paper]{book} \usepackage[T1]{fontenc} \usepackage{amsmath,amsfonts,amssymb} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{geometry} \begin{document} \pagestyle{empty} \begin{tikzpicture}[remember picture, overlay] \coordinate (Centro) at (current page.center); \coordinate (TopRight) at (current page.north east); \coordinate (TopLeft) at (current page.north west); \definecolor{bglight}{RGB}{172, 206, 184} \fill[bglight] (current page.south west) rectangle (current page.north east); \definecolor{clockgold}{RGB}{230, 177, 43} \definecolor{clockgreen}{RGB}{166, 209, 108} \definecolor{clockorange}{RGB}{240, 133, 41} \definecolor{clockgrey}{RGB}{140, 155, 145} \definecolor{gridblue}{RGB}{110, 150, 135} \definecolor{authorgreen}{RGB}{18, 92, 79} \node[anchor=north east, align=right, text width=7cm] at ($(TopRight)+(-1.5,-1.5)$) { {\fontfamily{ptm}\selectfont\LARGE\color{authorgreen}\textbf{Name Surname 1}}\\[0.2cm] {\fontfamily{ptm}\selectfont\LARGE\color{authorgreen}\textbf{Name Surname 2}} }; \node[anchor=north west, align=justify, text width=16cm] at ($(TopLeft)+(1.5,-3.5)$) { {\fontfamily{pnc}\selectfont\huge\itshape\color{white}Lezioni di}\\[0.3cm] {\fontfamily{pnc}\fontseries{b}\fontsize{44pt}{46pt}\selectfont\spaceskip=0.5em\color{white} LONGGGGGGGGGGG\\ [.4cm] LONGGGGGGGGGGG} }; \begin{scope}[shift={(Centro)}, scale=1.6] \begin{scope}[gridblue, opacity=0.5, line width=0.8pt] \foreach \k in {-4.5,-3.7,-2.9,-2.1,-1.3,-0.5,0.5,1.3,2.9,3.7,4.5} { \draw[smooth, samples=40] plot[domain=-5.5:4.5] ({ \k * (1 - 0.6 / (1 + 0.2*\k*\k + 0.2*\x*\x)) }, { \x * (1 - 0.6 / (1 + 0.2*\k*\k + 0.2*\x*\x)) }); } \foreach \k in {-5,-4.1,-3.2,-2.3,-1.4,-0.5,0.5,1.4,2.3,3.2,4} { \draw[smooth, samples=40] plot[domain=-4.8:4.8] ({ \x * (1 - 0.6 / (1 + 0.2*\x*\x + 0.2*\k*\k)) }, { \k * (1 - 0.6 / (1 + 0.2*\x*\x + 0.2*\k*\k)) }); } \end{scope} \fill[white, opacity=0.25, rotate around={12:(3.2,-1.5)}] (1.8,-3) rectangle (4,0); \fill[white, opacity=0.25, rotate around={-15:(-3,2)}] (-4.2,0.8) rectangle (-1.8,3.2); \begin{scope}[shift={(-2.8,2)}, rotate=-15, scale=0.95] \draw[white, fill=white, line width=4pt, line join=round] plot[smooth cycle, tension=0.5] coordinates {(-1,1.1) (1,0.9) (0.9,-1) (-1.1,-0.8)}; \draw[gray!60!black, line width=2pt, line join=round] plot[smooth cycle, tension=0.5] coordinates {(-1,1.1) (1,0.9) (0.9,-1) (-1.1,-0.8)}; \fill[clockgold] plot[smooth cycle, tension=0.5] coordinates {(-0.7,0.8) (0.7,0.7) (0.6,-0.7) (-0.7,-0.5)}; \fill[black] (0,0) circle (2.5pt); \draw[black, ultra thick, ->] plot[smooth, tension=1] coordinates{(0,0) (0.05, 0.25) (0.15,0.5)}; \draw[black, ultra thick, ->] plot[smooth, tension=1] coordinates{(0,0) (-0.2, -0.05) (-0.4,-0.1)}; \foreach \a in {0,90,180,270} \draw[white, thick] (\a:0.55) -- (\a:0.7); \end{scope} \begin{scope}[shift={(-2.6,-0.8)}, rotate=22, scale=1.05] \draw[white, fill=white, line width=4pt, line join=round] plot[smooth cycle, tension=0.7] coordinates {(-0.6,1.4) (0.8,0.4) (0.2,-1.5) (-0.9,-0.8)}; \draw[gray!60!black, line width=2.2pt, line join=round] plot[smooth cycle, tension=0.7] coordinates {(-0.6,1.4) (0.8,0.4) (0.2,-1.5) (-0.9,-0.8)}; \fill[clockgreen] plot[smooth cycle, tension=0.7] coordinates {(-0.4,1.1) (0.5,0.2) (0.1,-1.2) (-0.6,-0.6)}; \fill[black] (-0.1,-0.1) circle (2.5pt); \draw[black, ultra thick, ->] plot[smooth, tension=1] coordinates{(-0.1,-0.1) (0, 0.2) (0.15,0.6)}; \draw[black, ultra thick, ->] plot[smooth, tension=1] coordinates{(-0.1,-0.1) (0.05, -0.3) (0.2,-0.5)}; \draw[black!70, thick] (0.1,0.9) -- (0.2,1.1); \draw[black!70, thick] (-0.4,-0.8) -- (-0.5,-1.0); \end{scope} \begin{scope}[shift={(-.5,-3.6)}, rotate=-15, scale=0.9] \draw[white, fill=white, line width=4pt, line join=round] plot[smooth cycle, tension=0.7] coordinates {(-0.7,1.4) (0.8,1.2) (1.1,-2.2) (-0.9,-2.4)}; \draw[gray!60!black, line width=2pt, line join=round] plot[smooth cycle, tension=0.7] coordinates {(-0.7,1.4) (0.8,1.2) (1.1,-2.2) (-0.9,-2.4)}; \fill[clockgrey!70!clockgreen] plot[smooth cycle, tension=0.7] coordinates {(-0.5,1.1) (0.6,1.0) (0.8,-1.9) (-0.6,-2.0)}; \fill[black] (0.05,-0.1) circle (2.5pt); \draw[black, ultra thick, ->] plot[smooth, tension=1.2] coordinates{(0.05,-0.1) (-0.2, 0.4) (0.3,0.9)}; \draw[black, ultra thick, ->] plot[smooth, tension=1.2] coordinates{(0.05,-0.1) (0.4, -0.6) (0.1,-1.5)}; \draw[black!80, thick] (90:0.6) -- (90:0.8); \draw[black!80, thick] (0:0.5) -- (0:0.7); \draw[black!80, thick] (180:0.4) -- (180:0.6); \draw[black!80, thick] (270:0.6) -- (270:1.3); \end{scope} \begin{scope}[shift={(2.5,-3.8)}, rotate=-35, scale=1.1] \draw[white, fill=white, line width=4pt, line join=round] plot[smooth cycle, tension=0.4] coordinates {(-1.3,0.6) (1.3,0.7) (0.9,-0.6) (-1.1,-0.5)}; \draw[clockorange, line width=2.5pt, line join=round] plot[smooth cycle, tension=0.4] coordinates {(-1.3,0.6) (1.3,0.7) (0.9,-0.6) (-1.1,-0.5)}; \fill[black] (0,0) circle (2.5pt); \draw[black, ultra thick, ->] plot[smooth, tension=1] coordinates{(0,0) (0.3, 0.1) (0.7,0.2)}; \draw[black, ultra thick, ->] plot[smooth, tension=1] coordinates{(0,0) (-0.2, -0.05) (-0.5,-0.1)}; \draw[black!70, thick] (1,0.2) -- (1.2,0.2); \draw[black!70, thick] (-0.9,-0.2) -- (-1.1,-0.2); \end{scope} \begin{scope}[shift={(2.5,2.5)}, rotate=15, scale=0.85] \begin{scope}[shift={(-0.3, 0.2)}, rotate=5] \draw[white, fill=white, line width=3pt] (0,0) -- (110:1.2) arc(110:200:1.2) -- cycle; \fill[clockgrey!70!clockgreen] (0,0) -- (110:1.0) arc(110:200:1.0) -- cycle; \draw[black!80, thick] (180:0.7) -- (180:0.9); \draw[black!80, thick] (120:0.7) -- (120:0.9); \end{scope} \begin{scope}[shift={(0.2, 0.4)}, rotate=-8] \draw[white, fill=white, line width=3pt] (0,0) -- (10:1.3) arc(10:85:1.3) -- cycle; \fill[clockgrey!70!clockgreen] (0,0) -- (10:1.1) arc(10:85:1.1) -- cycle; \draw[black!80, thick] (0:0.8) -- (0:1.0); \draw[black!80, thick] (60:0.8) -- (60:1.0); \draw[black, ultra thick] (30:0.2) -- (45:0.7); \end{scope} \begin{scope}[shift={(0.0, -0.4)}, rotate=12] \draw[white, fill=white, line width=3pt] (0,0) -- (220:1.2) arc(220:340:1.2) -- cycle; \fill[clockgrey!70!clockgreen] (0,0) -- (220:1.0) arc(220:340:1.0) -- cycle; \draw[black!80, thick] (270:0.7) -- (270:0.9); \draw[black!80, thick] (300:0.7) -- (300:0.9); \end{scope} \begin{scope}[shift={(-0.8, -0.9)}, rotate=-30] \draw[white, fill=gray!40, line width=1.5pt] (0,0) -- (0.3,0.4) -- (-0.1,0.5) -- cycle; \end{scope} \begin{scope}[shift={(0.9, -0.2)}, rotate=45] \draw[white, fill=white, line width=2pt] (0,0) -- (0.4,0.1) -- (0.2,0.3) -- cycle; \end{scope} \fill[black] (-0.1,0.05) circle (2.5pt); \begin{scope}[shift={(-0.5, 0.8)}, rotate=25] \draw[black, ultra thick, ->] (0,0) -- (-0.4, 0.5); \end{scope} \draw[gray!80!black, thick, smooth] plot[domain=0:540, samples=40] (\x:{\x*0.001 + 0.05}); \end{scope} \begin{scope}[shift={(2.6,-1.4)}, rotate=45, scale=1.2] \draw[clockorange, line width=5pt, line join=round, fill=white, fill opacity=0.1] plot[smooth cycle, tension=0.2] coordinates {(-1.1,0.5) (1.1,0.5) (0.7,-0.5) (-0.7,-0.5)}; \end{scope} \end{scope} \end{tikzpicture} \clearpage \end{document}

  • How to clip at the edge of a *drawn* line?
    by karlh on July 17, 2026 at 1:01 am

    I am attempting to do a faded (partially-transparent) picture that is "outlined" at three different levels of opacity/color mixing. These should form the "convex boundary" (similar to that called for in "padded boundary of convex hull") of the original path with several different values of the "padding." The shape will, in general, be very complex (i.e., composed of many, many segments). Essentially, I want (almost) the inverse of this: \documentclass[tikz]{standalone} \usepackage{worldflags} \begin{document} \begin{tikzpicture} \pic [country=PT,length=4cm,width=4.5cm,framewidth=0pt] at (0.5,1.25) {worldflag}; \path [save path=\mypath] (0,0) -- (1,0.5) -- (1.5,1) -- (1,2) -- (0.5,1.5) -- (-0.25,2.5) -- (-0.5,0.5) -- cycle; \path [use path=\mypath,draw=black,line width=1.5cm,line join=round,opacity=0.05]; \path [use path=\mypath,draw=black,line width=0.4cm,line join=round,opacity=0.2]; \path [use path=\mypath,draw=black,line width=0.1cm,line join=round,opacity=0.4]; \path [use path=\mypath,fill=black,opacity=1]; \end{tikzpicture} \end{document} By "inverse" I mean that everywhere that is black in this image should be transparent, everything that is gray should be that % transparent, and everything outside the outermost boundary (the very slightly shaded region around the outside) should be clipped away or be filled with a background color. Note that I used the flag of Portugal as my picture here, but it can be any arbitrary image or drawing (assuming what I want to do is possible). I have tried using the nfold library (technically the offsetpath PGF library), but it has issues with concave shapes that are offset: \documentclass[tikz]{standalone} \usetikzlibrary{nfold} \usepackage{worldflags} \begin{document} \begin{tikzpicture} \coordinate (a) at (2,1); \coordinate (b) at (2.5,0.25); \coordinate (c) at (3,0.75); \coordinate (d) at (3.5,0); \coordinate (e) at (4,1); \coordinate (f) at (3,2); \path [save path=\island] (a) -- (b) -- (c) -- (d) -- (e) -- (f) -- cycle; \begin{scope} \pgfsetroundjoin \pgfoffsetpath{\island}{-5cm} \pgfpathclose \pgfusepath{clip} \pic [country=PT,width=12cm,at={(5cm,1cm)}] {worldflag}; \end{scope} \end{tikzpicture} I have also tried using the soft path (via spath3 and a subroutine I wrote myself using it), and that has similar issues with self-intersecting/overlapping offsets that occur with concave paths. Is there some way to say "use this drawing as a transparency mask" in TikZ? If not, I would appreciate referrals to libraries for which I should look through documentation. The final result should look something like this (without having to draw the outer path by hand, which I did to make this one): EDIT At the suggestion of Qrrbrbirlbel, I tried a variant using fadings. Issues: (a) it requires the path to be drawn explicitly twice (once in the preamble/fading definition and once in the body of the document) due to the definition of the fading; (b) I find that I have to rescale and/or translate the fit so it's in the right place, even though the fading and the path are drawn from the same coordinates, and (c) it requires scope fadings, which some PDF viewers (including evince/papers) do not display correctly for strokes, as shown below. \documentclass[tikz]{standalone} \usetikzlibrary{calc} \usepackage{worldflags} \begin{tikzfadingfrompicture}[name=island] \coordinate (a) at (2,1); \coordinate (b) at (2.5,0.25); \coordinate (c) at (3,0.75); \coordinate (d) at (3.5,0); \coordinate (e) at (4,1); \coordinate (f) at (3,2); \path [fill=transparent!100] (0,-2) rectangle (6,4); \path [save path=\island] (a) -- (b) -- (c) -- (d) -- (e) -- (f) -- cycle; \path [draw=transparent!95,line width=2cm,use path=\island]; \path [draw=transparent!80,line width=0.5cm,use path=\island]; \path [draw=transparent!60,line width=0.1cm,use path=\island]; \path [fill=transparent!0,use path=\island]; \end{tikzfadingfrompicture} \begin{document} \begin{tikzpicture} \coordinate (a) at (2,1); \coordinate (b) at (2.5,0.25); \coordinate (c) at (3,0.75); \coordinate (d) at (3.5,0); \coordinate (e) at (4,1); \coordinate (f) at (3,2); \path [fill=cyan] (0,-2) rectangle (6,4); \path [save path=\island] (a) -- (b) -- (c) -- (d) -- (e) -- (f) -- cycle; \begin{scope}[transparency group] % \path [scope fading=island,fit fading=true, % fading transform={scale=0.29}] (0,-2) rectangle (6,4); \path [scope fading=island,fit fading=false, fading transform={shift={(3cm,1cm)}}] (0,-2) rectangle (6,4); \pic [country=PT,width=6cm,length=6cm] at (3,1) {worldflag}; \end{scope} \path [draw=black,use path=\island]; \end{tikzpicture} \end{document} This looks OK in Xpdf, viz., but it is not displayed correctly in Evince or Papers, viz.,

  • Drawing and defining functions in tikz
    by Medulla Oblongata on July 16, 2026 at 2:48 pm

    I am trying to draw a graph (function of the form sin()*exp(-x^2)) inside an ellipse. How do I fit the graph inside the ellipse? I don't know how to scale and position it correctly. \documentclass[tikz]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[line width=1.2,fill=white] (1.5,0.5) ellipse (1.5 and 0.5); \draw[scale=0.1, domain=-20:20, samples=500, smooth, variable=\x, blue] (1.5,0.5) plot ({\x}, {0.5*sin(\x) * exp(-0.02*(\x)*(\x))}); \end{tikzpicture} \end{document} I want to produce something like:

  • Bezier curves with controls?
    by Raffaele Santoro on April 16, 2026 at 8:45 am

    How to make rounded corner and curve (..controls?) for this path (or similar)? \documentclass[margin={1.5cm 1,5cm 1.5cm 1.5cm}]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \fill[cyan] (0,0)--(2,0)--(5,2)--(7,3)--(6,4)--(4,7)--(2,7)--(.5,5)--(0,2)--cycle; \end{tikzpicture} \end{document}

  • How to position the node with `TikZ.positioning` relative to specific angle?
    by Explorer on October 31, 2024 at 2:07 am

    Let's consider the relative coordinate assignment from positioning library, with below left, we could assign 45 degree tilted node: \documentclass[tikz,border=8pt]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[ every node/.style={ draw, circle, inner sep=5pt, outer sep=0pt, fill=cyan!20 } ] \node (O) {$1$}; \node (A) [below left=of O] {$2$} edge (O); \node (B) [below left=of A] {$3$} edge (A); \end{tikzpicture} \end{document} But if I want to change the tilted slope, says for example, 60 degree. Let's assume the following syntax: \documentclass[tikz,border=8pt]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[ every node/.style={ draw, circle, inner sep=5pt, outer sep=0pt, fill=cyan!20 } ] \node (O) {$1$}; % \node (A) [below left={60}{of O}] {$2$} edge (O); % \node (B) [below right={60}{of A}] {$3$} edge (A); \node (A) at ({-sqrt(3)},-3) {$2$} edge (O); \node (B) at (0,-6) {$3$} edge (A); \end{tikzpicture} \end{document} I want the syntax(claim that the assuming syntax here was not the must, I just want to show I want an "angle" key to control the tlited slope, any syntax that allow me to specify the angle 60 here is okay!) such as: \node (A) [below left={60}{of O}] {$2$} edge (O); \node (B) [below right={60}{of A}] {$3$} edge (A); to get the node A and B with following: But not with absolute coordinate. Any suggestions?

  • An interesting example of Horizontal and Vertical Lines in TIKZ?
    by Explorer on August 17, 2024 at 5:17 pm

    I get a little confused by the case of the following example. I learn about the meaning of |- and -| in tikz manuals, but the usage like (1,2 -| S) actually raised my curiosity. the code is as below \documentclass[tikz,border=3.14pt]{standalone} \begin{document} \begin{tikzpicture} \draw[help lines] (-2,-2) grid (4,4); \coordinate (S) at (2,2); \draw[red,thick] (0,0) -- (0,0 -| S); \draw[blue,thick] (0,0) -- (0,0 |- S); \end{tikzpicture} \begin{tikzpicture} \draw[help lines] (-2,-2) grid (4,4); \coordinate (S) at (2,3); \draw[red,thick] (0,0) -- (1,0 -| S); \draw[blue,thick] (0,0) -- (-1,-2 |- S); \end{tikzpicture} \begin{tikzpicture} \draw[help lines] (-2,-2) grid (4,4); \coordinate (S) at (2,3); \draw[red,thick] (0,0) -- (1,-| S); \draw[blue,thick] (0,0) -- (-1,|- S); \end{tikzpicture} \end{document} and I then get the result: I couln't make sense the behavior with the following docs clearly, just guess the with |- S represented the y-coordinate of S, while the -| S represented the x-coordinate of S, is there some docs I left out? How can I know what will happen as (x,y -| <point>) or just (x, |- <point>) or even (,y |- <point>) from the docs?Thanks!

  • How to adjust vertical placement of figure before chapter, chapter heading and section heading in scrbook?
    by Damitr on April 24, 2024 at 9:45 am

    I am trying to create equal vertical spacing in a figure placed at top of page before chapter heading, chapter heading and section heading in scrbook. I tried using the inbuilt koma commands but it is not giving the desired results (or I am not using them correctly. How can I do verical adjustments for the chapter and section headings so that they appear more balanced? MWE \documentclass[10pt]{scrbook} \usepackage{geometry} \geometry{paperheight=150mm,paperwidth=150mm, textwidth=75mm, textheight=100mm, top=20mm, bottom=20mm, marginparwidth=38mm, headsep=8mm, left=10mm, right=55mm, marginparsep=7mm, footskip=10mm} \usepackage{tikz} \RedeclareSectionCommand[beforeskip=2.75cm]{chapter} \RedeclareSectionCommand[afterskip=1cm]{chapter} \RedeclareSectionCommand[beforeskip=0.1\baselineskip,afterskip=0.25\baselineskip]{section} \begin{document} \chapter{first lesson} \label{ch-01} \begin{tikzpicture}[remember picture,overlay,shift=(current page.north west)] \begin{scope}[x={(current page.north east)},y={(current page.south west)}] \node [overlay,remember picture] at (0.5,0.2) {\includegraphics[width=1.2\textwidth]{fig-ch-01-head.pdf}}; \end{scope} \end{tikzpicture} \section{first section} \end{document}

  • Error with using Forest and Tikz externalization
    by vmariani on March 21, 2023 at 7:20 pm

    I can't seem to figure out why my forest externalization fails. It always works properly on the first compile, and if I clear any temporary files from my directory, but otherwise making any change to the tree and trying to recompile fails entirely with the following error: ./Untitled.tex:15: Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Untitled-forest-3" "\def\tikzexternalrealjob{Untitled}\input{Untitled}"' did NOT result in a usable output file 'Untitled-forest-3' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in 'Untitled-forest-3.log'. If you continue now, I'll try to typeset the picture. Here is a MWE: \documentclass{article} \usepackage[linguistics, external]{forest} \usetikzlibrary{external} \tikzexternalize \begin{document} Forest: \begin{forest} [VP [V] [NP] ] \end{forest} \end{document} And I'll include the full log, in case there's something I'm missing: This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) \write18 enabled. entering extended mode (./Untitled.tex LaTeX2e <2022-11-01> patch level 1 L3 programming layer <2023-02-07> (/usr/local/texlive/2022/texmf-dist/tex/latex/base/article.cls Document Class: article 2022/07/02 v1.4n Standard LaTeX document class (/usr/local/texlive/2022/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2022/texmf-dist/tex/latex/forest/forest.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/pgf.revision.tex))) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-def/pdftex.def))) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeyslibraryfiltered.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfint.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty)) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgffor.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/math/pgfmath.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.geometric.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.misc.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.symbols.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.arrows.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.callouts.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.multipart.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgfopts/pgfopts.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/elocalloc/elocalloc.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/environ/environ.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/trimspaces/trimspaces.sty)) (/usr/local/texlive/2022/texmf-dist/tex/latex/l3packages/xparse/xparse.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def))) (/usr/local/texlive/2022/texmf-dist/tex/latex/inlinedef/inlinedef.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty) (/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty) (/usr/local/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/latex/forest/forest-lib-linguistics.sty) (/Users/vincentmariani/Desktop/.texpadtmp/Untitled.aux) (/usr/local/texlive/2022/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/local/texlive/2022/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) (/Users/vincentmariani/Desktop/.texpadtmp/Untitled.for)This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) \write18 enabled. entering extended mode ===== 'mode=convert with system call': Invoking 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Untitled-forest-3" "\def\tikzexternalrealjob{Untitled}\input{Untitled}"' ======== ===== The last system call resulted in an EMPTY output file. Maybe it is part of \ref. Rescheduling it for \end{document}. ======== [1{/usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (/Users/vincentmariani/Desktop/.texpadtmp/Untitled.aux)This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) \write18 enabled. entering extended mode ===== tikzexternal: \end{document} reached. Working on rescheduled images to resolve references... ======== ===== 'mode=convert with system call': Invoking 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Untitled-forest-3" "\def\tikzexternalrealjob{Untitled}\input{Untitled}"' ======== ./Untitled.tex:15: Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Untitled-forest-3" "\def\tikzexternalrealjob{Untitled}\input{Untitled}"' did NOT result in a usable output file 'Untitled-forest-3' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in 'Untitled-forest-3.log'. If you continue now, I'll try to typeset the picture. See the tikz package documentation for explanation. Type H <return> for immediate help. ... l.15 \end{document} ) (see the transcript file for additional information)</usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb> Output written on /Users/vincentmariani/Desktop/.texpadtmp/Untitled.pdf (1 page, 12327 bytes). SyncTeX written on /Users/vincentmariani/Desktop/.texpadtmp/Untitled.synctex.gz. Transcript written on /Users/vincentmariani/Desktop/.texpadtmp/Untitled.log. /Library/TeX/texbin/pdflatex -file-line-error -interaction=nonstopmode -synctex=1 -shell-escape -output-directory=/Users/vincentmariani/Desktop/.texpadtmp Untitled.tex This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) \write18 enabled. entering extended mode (./Untitled.tex LaTeX2e <2022-11-01> patch level 1 L3 programming layer <2023-02-07> (/usr/local/texlive/2022/texmf-dist/tex/latex/base/article.cls Document Class: article 2022/07/02 v1.4n Standard LaTeX document class (/usr/local/texlive/2022/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2022/texmf-dist/tex/latex/forest/forest.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/pgf.revision.tex))) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-def/pdftex.def))) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeyslibraryfiltered.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/mathcolor.ltx)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfint.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty)) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgffor.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/math/pgfmath.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarytopaths.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.geometric.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.geometric.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.misc.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.misc.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.symbols.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.symbols.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.arrows.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.arrows.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.callouts.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.callouts.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshapes.multipart.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/shapes/pgflibraryshapes.multipart.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex)) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgfopts/pgfopts.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/elocalloc/elocalloc.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/environ/environ.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/trimspaces/trimspaces.sty)) (/usr/local/texlive/2022/texmf-dist/tex/latex/l3packages/xparse/xparse.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def))) (/usr/local/texlive/2022/texmf-dist/tex/latex/inlinedef/inlinedef.sty) (/usr/local/texlive/2022/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty) (/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty) (/usr/local/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/local/texlive/2022/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex))) (/usr/local/texlive/2022/texmf-dist/tex/latex/forest/forest-lib-linguistics.sty) (/Users/vincentmariani/Desktop/.texpadtmp/Untitled.aux) (/usr/local/texlive/2022/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/local/texlive/2022/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty (/usr/local/texlive/2022/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) (/Users/vincentmariani/Desktop/.texpadtmp/Untitled.for)This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) \write18 enabled. entering extended mode ===== 'mode=convert with system call': Invoking 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Untitled-forest-3" "\def\tikzexternalrealjob{Untitled}\input{Untitled}"' ======== ===== The last system call resulted in an EMPTY output file. Maybe it is part of \ref. Rescheduling it for \end{document}. ======== [1{/usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (/Users/vincentmariani/Desktop/.texpadtmp/Untitled.aux)This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) \write18 enabled. entering extended mode ===== tikzexternal: \end{document} reached. Working on rescheduled images to resolve references... ======== ===== 'mode=convert with system call': Invoking 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Untitled-forest-3" "\def\tikzexternalrealjob{Untitled}\input{Untitled}"' ======== ./Untitled.tex:15: Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "Untitled-forest-3" "\def\tikzexternalrealjob{Untitled}\input{Untitled}"' did NOT result in a usable output file 'Untitled-forest-3' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in 'Untitled-forest-3.log'. If you continue now, I'll try to typeset the picture. See the tikz package documentation for explanation. Type H <return> for immediate help. ... l.15 \end{document} ) (see the transcript file for additional information)</usr/local/texlive/2022/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb> Output written on /Users/vincentmariani/Desktop/.texpadtmp/Untitled.pdf (1 page, 12327 bytes). SyncTeX written on /Users/vincentmariani/Desktop/.texpadtmp/Untitled.synctex.gz. Transcript written on /Users/vincentmariani/Desktop/.texpadtmp/Untitled.log.

  • Beamer class: text height too large for height of footline and headline with tikz pictures
    by Daniel Stich on March 9, 2022 at 11:39 pm

    I tried to recreate my university powerpoint template which includes images as headline and footline banner (beamer class, no predefined theme, xelatex). It seemed easier to place image plus text with tikz. When placing text in frames, text starts within the headline and violates the footline (positioning t or b). My MWE draws a box with \textheightto illustrate the problem. I found this code snippet which should somehow increase the height of the footline but it didn't solve the problem. I hope someone can help me out. Thanks! \makeatletter \patchcmd{\beamer@calculateheadfoot}{\advance\footheight by 4pt}{\advance\footheight by 20pt}{}{} \makeatother MWE: \documentclass[ presentation, %handout, 11pt, aspectratio=43, % 4:3, 128mm:96mm table, usepdftitle=false, ]{beamer} % Packages \usepackage{tikz} \usetikzlibrary{arrows, shapes.arrows, arrows.meta, positioning, fit, calc, backgrounds, patterns, 3d} % Lengths \newlength{\myLeftMargin} \newlength{\myLeftMarginText} \newlength{\myRightMargin} \newlength{\myRightMarginText} \setlength{\myLeftMargin}{0.019685\paperwidth} \setlength{\myLeftMarginText}{0.0909\paperwidth} \setlength{\myRightMargin}{\myLeftMargin} \setlength{\myRightMarginText}{\myLeftMarginText} \setbeamersize{text margin left=\myLeftMarginText} \setbeamersize{text margin right=\myRightMarginText} \setbeamersize{sidebar width left=0pt} % Headline \makeatletter \patchcmd{\beamer@calculateheadfoot}{\advance\footheight by 4pt}{\advance\footheight by 20pt}{}{} \makeatother \setbeamertemplate{headline}{% \begin{tikzpicture}[overlay, remember picture] \node[anchor=north west, inner sep=0pt] at ($(current page.north west)+(0,0)$) (nodeHeadlineBar){ \includegraphics[width=\paperwidth, height=0.15\paperheight]{example-image} }; \end{tikzpicture}% } \setbeamertemplate{frametitle}{% \begin{tikzpicture}[overlay, remember picture] \node[anchor=west, inner sep=0pt] at ($(nodeHeadlineBar.west)+(\myLeftMargin,0)$){ \insertframetitle }; \end{tikzpicture}% } \setbeamertemplate{footline}{% \begin{tikzpicture}[overlay, remember picture] \node[anchor=south west, inner sep=0pt] at ($(current page.south west)+(0,0)$) (nodeFootlineBar){ \includegraphics[width=\paperwidth, height=0.05\paperheight]{example-image} }; \node[anchor=east, inner sep=0pt] at ($(nodeFootlineBar.east)+(-\myRightMargin,0)$){ \insertframenumber\,/\,\inserttotalframenumber }; \end{tikzpicture}% } \begin{document} \section{Example 1} \begin{frame}[b]{\secname} \begin{tikzpicture} \draw[red] (0,0) rectangle (\textwidth,\textheight); \draw[red] (0,\textheight) -- (\textwidth,0) (0,0) -- (\textwidth, \textheight); \end{tikzpicture} \end{frame} \section{Example 2} \begin{frame}[t]{\secname} \begin{tikzpicture} \draw[red] (0,0) rectangle (\textwidth,\textheight); \draw[red] (0,\textheight) -- (\textwidth,0) (0,0) -- (\textwidth, \textheight); \end{tikzpicture} \end{frame} \end{document}

  • Double entry table
    by Dunno on May 27, 2021 at 10:23 am

    I would like to make a double entry table in LaTeX. Here is the result that I would like to get: I found a clue here: \documentclass{article} \usepackage{multirow} \begin{document} \begin{center} \begin{tabular}{ c || l | r | c } & \multicolumn{3}{c}{Columns} \\ \hline \hline \multirow{3}{*}{Rows} & A1 & B1 & C1 \\ \cline{2-4} & A222 & B22 & C2 \\ \cline{2-4} & A3 & B333 & C33 \end{tabular} \end{center} \end{document} I managed to get a partial solution: \begin{document} \begin{center} \begin{tabular}{ l || r | c } A1 & B1 & C1 \\ \hline \hline A222 & B22 & C2 \\ \hline A3 & B333 & C33 \end{tabular} \end{center} \end{document} However, it doesn't solve all my problems. Is it possible to get square cells with everything centered in the cell? I found other partial solutions here but I don't know tikz at all. The matrix environment might not suit my needs because I would like to avoid outer borders and I didn't find any solution with double lines separing row's titles from the inner cells.

  • Modeling randomly generated inscribed triangles
    by Logan Weinert on March 24, 2020 at 8:02 pm

    The problem I am modeling: Three points are randomly chosen on a circle. What is the probability that the triangle formed by these three points contains the center of the circle? Conceptual understanding: Suppose we fix two of the three points, call them A and B. In order for the triangle to contain the center, the third point C must lie within the arc A'B', where A' and B' are the image of points A and B respectively under a rotation of 180 degrees. What I want to happen: The randomly generated inscribed triangle to be filled green when it contains the center, and to fill red when it does not contain the center. I would also like to keep tally of the number of successes and failures to compute an experimental probability. A few key things: I have access to the x and y coordinates of each point by using \pgfextractx and \pgfextracty. My method was to test whether the point C is between both the x-coordinates and y-coordinates of A and B by using \xintifboolexpr, however, this is flawed. Minimal Working Example: \documentclass{article} \usepackage[left=2cm, right=2cm, top=2cm, bottom=1cm]{geometry} \usepackage{amsmath,amsfonts,tikz,xintexpr,calc} \newcommand\circletest{ \begin{tikzpicture}[scale=0.6] \newdimen{\tempxa} \newdimen{\tempya} \newdimen{\tempxb} \newdimen{\tempyb} \newdimen{\tempxc} \newdimen{\tempyc} \def\radius{2} \draw (0,0) coordinate (O); \draw (O) circle[radius=\radius]; \draw (rnd*360:\radius) coordinate (A); \pgfextractx\tempxa{\pgfpointanchor{A}{center}} \pgfextracty\tempya{\pgfpointanchor{A}{center}} \draw (rnd*360:\radius) coordinate (B); \pgfextractx\tempxb{\pgfpointanchor{B}{center}} \pgfextracty\tempyb{\pgfpointanchor{B}{center}} \draw (rnd*360:\radius) coordinate (C); \pgfextractx\tempxc{\pgfpointanchor{C}{center}} \pgfextracty\tempyc{\pgfpointanchor{C}{center}} \xintifboolexpr { (((\tempxc > -\tempxa) && (\tempxc < -\tempxb)) || ((\tempxc > -\tempxb) && (\tempxc < -\tempxa))) && (((\tempyc > -\tempya) && (\tempyc < -\tempyb)) || ((\tempyc > -\tempyb) && (\tempyc < -\tempya)))} %%I know this is grotesque {\filldraw[color=green!80!black!100, fill=green!15] (A) -- (B) -- (C) -- cycle;} %true {\filldraw[color=red!80!black!100, fill=red!15] (A) -- (B) -- (C) -- cycle;} %false \fill[black] (A) circle[radius=2pt]; \fill[black] (B) circle[radius=2pt]; \fill[black] (C) circle[radius=2pt]; \fill[black] (O) circle[radius=2pt]; \draw (A) node[below]{A}; \draw (B) node[below]{B}; \draw (C) node[below]{C}; \end{tikzpicture}} \begin{document} \foreach \x in {0,1,...,11}{ \circletest } \end{document} The issue I am having: Clearly my comparison operator \xintifboolexpr, along with my grotesque code following it is the problem. I am seeking a simpler method to tell if the point C is along the arc of the circle between (-\tempax,-\tempay) and (-\tempbx,-\tempby). EDIT: A correct solution from Sandy G's suggestion. \documentclass{article} \usepackage[left=2cm, right=2cm, top=2cm, bottom=1cm]{geometry} \usepackage{amsmath,amsfonts,tikz,xintexpr,calc} \usepackage{xfp} \newcommand\circletest{ \begin{tikzpicture}[scale=0.6] \pgfmathsetmacro{\rndA}{rnd*360} \pgfmathsetmacro{\rndB}{rnd*360} \pgfmathsetmacro{\rndC}{rnd*360} %defining x and y coordinates of each point \def\radius{2} \def\xa{\fpeval{\radius*cosd(\rndA)}} \def\ya{\fpeval{\radius*sind(\rndA)}} \def\xb{\fpeval{\radius*cosd(\rndB)}} \def\yb{\fpeval{\radius*sind(\rndB)}} \def\xc{\fpeval{\radius*cosd(\rndC)}} \def\yc{\fpeval{\radius*sind(\rndC)}} %calculating side lengths of triangle \def\A{\fpeval{sqrt((\xb-\xc)^2 + (\yb-\yc)^2)}} \def\B{\fpeval{sqrt((\xa-\xc)^2 + (\ya-\yc)^2)}} \def\C{\fpeval{sqrt((\xa-\xb)^2 + (\ya-\yb)^2)}} %calculating angles of triangle \def\angleA{\fpeval{acosd((\B^2 + \C^2 -\A^2)/(2*\B*\C))}} \def\angleB{\fpeval{acosd((\C^2 + \A^2 -\B^2)/(2*\C*\A))}} \def\angleC{\fpeval{acosd((\A^2 + \B^2 -\C^2)/(2*\A*\B))}} %defining some coordinates \draw (0,0) coordinate (O); \draw (O) circle[radius=\radius]; \draw (\xa,\ya) coordinate (A); \draw (\xb,\yb) coordinate (B); \draw (\xc,\yc) coordinate (C); %test if center is in circle \xintifboolexpr{((\angleA < 90) && (\angleB < 90)) && (\angleC < 90)} {\filldraw[color=green!80!black!100, fill=green!15] (A) -- (B) -- (C) -- cycle;} %true {\filldraw[color=red!80!black!100, fill=red!15] (A) -- (B) -- (C) -- cycle;} %false %Drawing points on top of line \draw[fill=black] (\xa,\ya) circle(1.5pt); \draw[fill=black] (\xb,\yb) circle(1.5pt); \draw[fill=black] (\xc,\yc) circle(1.5pt); \draw[fill=black] (O) circle(1.5pt); \end{tikzpicture}} \begin{document} \foreach \x in {0,1,...,30}{ \circletest } \end{document}

  • Code highlighting drawn under tcolorbox and not displayed
    by Zoefschildpad on March 10, 2020 at 10:07 am

    I am looking to add highlighting to listings. I have tried to adept the techniques given by https://tex.stackexchange.com/users/23765/siracusa in the question Highlight text in code listing while also keeping syntax highlighting However I have run into a problem, which is demonstrated in the example below. I want my listing to be inside a tcolorbox. When it isn't in a tcolorbox, the highlighting works as expected. When it is inside the box, the highlighting is rendered properly and in the right place, but it isn't displayed because the tcolorbox seems to be drawn on top of it. Is there a way to draw the highlighting on top of the box (but still under the text) instead? I would really like to keep the core of the highlighting solution, because it plays really nicely with the listings package. Also note that any solution that involves manually adjustments to individual codeblocks is not an option. Their contents are generated by another program, and there are thousands. \LoadClass[10pt]{book} \RequirePackage{fontspec} \RequirePackage{listings} \RequirePackage{xcolor} \RequirePackage{atbegshi} \RequirePackage{ifthen} \RequirePackage{tikz} \usetikzlibrary{calc} \usetikzlibrary{fit} \RequirePackage[breakable]{tcolorbox} % HIGHLIGHTING \makeatletter \newcommand\if@empty[1]{% \if\relax\detokenize{#1}\relax \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi } \newcommand\ifthen[2]{\ifthenelse{#1}{#2}{}} \newcommand\ifelse[2]{\ifthenelse{#1}{}{#2}} % Is highlighting currently active in the listings environment? \newif\ifhl@active % Material executed at each page shipout \newtoks\hl@shipout % Extra styling parameters for the currently active highlight \newtoks\hl@parameters % Inline highlight style. This does not break across line ends \newcommand\hl[2][]{\begingroup\hlstyle@start{#1}#2\endgroup} % The highlight style for listings environments \newcommand\hlstyle[1][]{\hlstyle@start{#1}} \newcommand\hlstyle@start[1]{% \global\hl@activetrue \aftergroup\hlstyle@end \write\@auxout{\noexpand\hl@setparameters{#1}}% \hl@mark{S}% } \newcommand\hlstyle@end{% \hl@mark{E}% \global\hl@activefalse } % Sets the current highlight parameters \newcommand\hl@setparameters[1]{% \global\hl@parameters={#1}% } % Writes a new node marker with the current position and page number to the .aux file \newcommand\hl@mark[1]{% \ensuremath{\vcenter{\hbox{\pdfsavepos}}}% \write\@auxout{\noexpand\hl@processmark{#1}{\the\pdflastxpos}{\the\pdflastypos}{\arabic{page}}}% } % Writes the current page origin to the .aux file, and issues the current \hl@shipout material % to be processed \AtBeginShipout{\AtBeginShipoutUpperLeft{% \pdfsavepos \write\@auxout{\noexpand\hl@processmark{Z}{\the\pdflastxpos}{\the\pdflastypos}{\arabic{page}}}% \hl@doshipout }} % Maintains the current first and last node positions, checks whether a node marker should be used % for the current highlighting segment, and issues a \hl@draw call if necessary. % #1 is either 'S' (start node), 'M' (intermediate node), 'E' (end node), or 'Z' (page origin) % #2/#3 are the x/y-coordinates, #4 is the page number \newcommand\hl@processmark[4]{% \if#1S% \xdef\hl@firstx{#2}% \xdef\hl@firsty{#3}% \xdef\hl@firstp{#4}% \else\if#1M% \ifthenelse{\hl@firsty=#3}{% % Still on same line \xdef\hl@lastx{#2}% \xdef\hl@lasty{#3}% }{% \ifelse{\hl@firstx=\hl@lastx \and \hl@firsty=\hl@lasty}{% % Last highlight part is not empty \expandafter\hl@draw\expandafter{\the\hl@parameters}% }% \xdef\hl@firstx{#2}% \xdef\hl@firsty{#3}% \xdef\hl@firstp{#4}% }% \else\if#1E% \ifthen{\hl@firsty=#3}{% % Still on same line \xdef\hl@lastx{#2}% \xdef\hl@lasty{#3}% \ifelse{\hl@firstx=#2}{% % Last highlight part is not empty \expandafter\hl@draw\expandafter{\the\hl@parameters}% }% }% \else\if#1Z% \xdef\hl@zerox{#2}% \xdef\hl@zeroy{#3}% \fi\fi\fi\fi } % Add a new highlight segment to \hl@shipout to be processed on every shipout. % #1 is the styling command used to draw the segment within a properly positioned \tikz call. % If #1 is empty, \hldefaultstyle is used as a default. Every styling command can take % arbitrary parameters, only the last four are mandatory (x_first, y_first, x_last, y_last) \newcommand\hl@draw[1]{% \edef\@temp{{\noexpand\tikz [ overlay, shift = {(-\hl@zerox sp, -\hl@zeroy sp)} ] {\if@empty{#1}{\noexpand\hldefaultstyle}{\unexpanded{#1}}% {\hl@firstx sp}{\hl@firsty sp}{\hl@lastx sp}{\hl@lasty sp}}}% {\hl@firstp}% }% \expandafter\global\expandafter\addto@hook\expandafter\hl@shipout\expandafter{\@temp}% } % Processes the current \hl@shipout material. The material is a sequence of % {TikZ commands}{page number} pairs \def\hl@doshipout{% \expandafter\hl@doshipout@\the\hl@shipout{}{}\@end } \def\hl@doshipout@#1#2#3\@end{% \if@empty{#2}{}{% \ifthen{\arabic{page}=#2}{#1}% \hl@doshipout@#3\@end }% } % Hook into listings' discretionary breaks \let\orig@lst@discretionary=\lst@discretionary \gdef\lst@discretionary{% \ifhl@active \hl@mark{M}% \fi \orig@lst@discretionary \ifhl@active \hl@mark{M}% \fi } % Styling command for a simple marker highlights \newcommand\hlmarkerstyle[5][yellow]{% \draw [ line width = \baselineskip, #1 ] (#2, #3) -- (#4, #5); } % Default styling command \let\hldefaultstyle=\hlmarkerstyle \makeatother \newcommand\delimstyleB{\hlstyle} %ENDHIGHLIGHTING %% Define custom verbatim as listing allowing background color and mark notation \let\verbatim\someundefinedcommand \lstnewenvironment{CustomVerbatim}[1][name=main] { \lstset{ basicstyle=\fontsize{8}{8}\ttfamily, moredelim=**[is][\delimstyleB]{`}{`}, aboveskip=3mm, breaklines=true, breakatwhitespace=false, keepspaces=true, extendedchars=true, xleftmargin=8pt, xrightmargin=8pt, framextopmargin=3pt, framexbottommargin=3pt, frame=tb, framerule=0pt, escapeinside={¬}{¬}, postbreak=\mbox{\textcolor{blue}{$\hookrightarrow$}\space}, #1 } } {} \newtcolorbox{codebox}[1][] { #1, breakable, size=fbox, arc=0mm, colback=red, colframe=red, } \begin{document} \begin{codebox}\begin{CustomVerbatim}% The text of this `codeblock should be partially highlighted. However, the red box is blocking the highlighting.` \end{CustomVerbatim}\end{codebox} \begin{CustomVerbatim}% The text of `this codeblock is properly partially highlighted, even across multiple lines because it` isn't in a tcolorbox \end{CustomVerbatim} \end{document}

  • tikz-3dplot: angle-placed cones in a sphere
    by cis on August 8, 2019 at 5:23 pm

    I asked myself: Is there a simple way to transform the solution "small circles of a sphere" from @John Kormylo (code below) into cones, placed in the sphere by the two angles theta and phi? Hint: I saw some cone-solutions here; but I think they have not been complicated placed by the two spheric angles theta and phi. Hint: I want to draw this picture (with 8 cones): Probably one cone would be sufficient, so that I can do the rest if necessary. MWE from @JohnKormylo: \documentclass[margin=5mm, tikz]{standalone} \usepackage{mathtools} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{arrows,calc,backgrounds} \begin{document} \pgfmathsetmacro{\R}{3} % \pgfmathsetmacro{\a}{1.5} % \pgfmathsetmacro{\r}{sqrt(\R*\R-\a*\a} % %\pgfmathsetmacro{\Alpha}{atan(\r/\a)} \pgfmathsetmacro{\Alpha}{acos(\a/\R)} % \pgfkeys{/tikz/savevalue/.code 2 args={\global\edef#1{#2}}} \tdplotsetmaincoords{60}{110} \begin{tikzpicture}[ tdplot_main_coords, >=latex, font=\footnotesize, ] \coordinate[label=$Z$] (Z) at (0,0,0); \pgfmathsetmacro{\Teta}{90} % measured to the z-axis \pgfmathsetmacro{\Phi}{50} % measured to the x-axis \tdplotsetrotatedcoords{50}{90}{0} \begin{scope}[tdplot_rotated_coords] \coordinate[label=$A$] (A) at (0,0,\R); \coordinate[label=$M$] (M) at (0,0,\a); \draw[red, thick] (M) circle[radius=\r]; \end{scope} \draw[thick] (Z) -- (A); \draw[red, thick] (Z) -- (M); % Point P of direction vector p \pgfmathsetmacro{\xP}{\R*sin(\Teta-\Alpha)*cos(\Phi)} % \pgfmathsetmacro{\yP}{\R*sin(\Teta-\Alpha)*sin(\Phi)} % \pgfmathsetmacro{\zP}{\R*cos(\Teta-\Alpha)} % \coordinate[label=$P$] (P) at (\xP,\yP,\zP); \draw[thick] (Z) -- (P); \draw[->] (M) -- (P); \path let \p0 = (M), % Center \p1 = (P), \n1 = {veclen(\y1-\y0,\x1-\x0)}, \n2={atan2(\y1-\y0,\x1-\x0)} in [savevalue={\Radius}{\n1}, savevalue={\angle}{\n2}]; \pgfmathsetmacro{\RadiusP}{\Radius/28.4528} % wipe of 'pt' % Point Q of direction vector q \pgfmathsetmacro{\xQ}{\R*sin(\Teta)*cos(\Phi-\Alpha)} % \pgfmathsetmacro{\yQ}{\R*sin(\Teta)*sin(\Phi-\Alpha)} % \pgfmathsetmacro{\zQ}{\R*cos(\Teta)} % \coordinate[label=$Q$] (Q) at (\xQ,\yQ,\zQ); \draw[thick] (Z) -- (Q); \draw[->] (M) -- (Q); \path let \p0 = (M), % Center \p1 = (Q), \n1 = {veclen(\y1-\y0,\x1-\x0)}, \n2={atan2(\y1-\y0,\x1-\x0)} in [savevalue={\Radius}{\n1}, savevalue={\angle}{\n2}]; \pgfmathsetmacro{\RadiusQ}{\Radius/28.4528} % wipe of 'pt' %OLD % 3D Small Circle %\foreach \t in {0,...,360}{ %\pgfmathsetmacro{\rp}{cos(\t)*\r/\RadiusP} % %\pgfmathsetmacro{\rq}{sin(\t)*\r/\RadiusQ} % %\coordinate[label=$$] (X) at ($(M)+\rp*(P)-\rp*(M)+\rq*(Q)-\rq*(M)$); %\draw[red] (X) circle (1pt); %} % Sphere \begin{scope}[tdplot_screen_coords, on background layer] \fill[ball color= gray!20, opacity = 0.3] (Z) circle (\R); \end{scope} \begin{scope}[-latex, shift={(Z)}, xshift=0*2.1*\R cm, yshift=0*0.1*\R cm] \foreach \P/\s/\Pos in {(5,0,0)/x/right, (0,5,0)/y/below, (0,0,5)/z/right} \draw[] (0,0,0) -- \P node (\s) [\Pos, pos=0.9,inner sep=2pt]{$\s$}; \node[above=1cm, align=left, font=\normalsize] at (z){Equation of a 3D-circle: \\ $\vec{x} = \vec{m} + r \cos(t) \cdot \vec{p} + r \sin(t) \cdot \vec{q} ~~\text{(with $t = 0\dots 2\pi$)}$ }; \end{scope} \end{tikzpicture} \end{document}

  • tikz-3dplot: How to draw small circles of a sphere in a given angle?
    by cis on July 24, 2019 at 2:19 pm

    What is the right method to draw a small circle at a certain angle? I can only do it improvisational for the right angle. Hint: I want to draw such a picture: \documentclass[margin=5mm, tikz]{standalone} \usepackage{amsmath, amsfonts} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{arrows,calc,backgrounds} \begin{document} \pgfmathsetmacro{\r}{2.6} % \tdplotsetmaincoords{60}{110} \begin{tikzpicture}[ tdplot_main_coords, %tdplot_rotated_coords, font=\footnotesize, Helpcircle/.style={gray!70!black, %densely dashed }, ] \pgfmathsetmacro{\h}{0.9*\r} % \coordinate[label=$M$] (M) at (0,0,0); \coordinate[label=$S$] (S) at (0,0,\h); \draw[Helpcircle] (M) circle[radius=\r]; \draw[Helpcircle] ([shift={(0,0,\h)}]M) circle[radius=sqrt(\r^2-\h^2)]; \draw[Helpcircle, rotate=90, red] (0,0,-\h) coordinate[label=$A$] (A) circle[radius=sqrt(\r^2-\h^2)]; \draw[] (M) -- (A); \pgfmathsetmacro{\teta}{30} % \pgfmathsetmacro{\y}{-\h*cos(\teta)} % \draw[blue] (M) -- ([xshift=\r cm, yshift=\y cm]M); % Sphere \begin{scope}[tdplot_screen_coords, on background layer] \fill[ball color= gray!20, opacity = 0.25] (M) circle (\r); \end{scope} %% Points \foreach \P in {M,S, A}{ \shade[ball color=white] (\P) circle (1.75pt); } \begin{scope}[-latex, shift={(M)}, xshift=1.5*\r cm, yshift=0.1*\r cm] \foreach \P/\s/\Pos in {(1,0,0)/x/right, (0,1,0)/y/below, (0,0,1)/z/right} \draw[] (0,0,0) -- \P node[\Pos, pos=0.9,inner sep=2pt]{$\s$}; \end{scope} \end{tikzpicture} \end{document}

  • Add an angle to a sphere
    by medihde on April 8, 2019 at 2:35 pm

    I have a sphere (taken from http://www.texample.net/tikz/examples/, credits to Bartman): % Steradian cone in sphere % Author: Bartman \documentclass[tikz,border=10pt]{standalone} %%%< \usepackage{verbatim} %%%> \begin{comment} :Title: Steradian cone in sphere :Tags: 3D;Angles;Intersections;Shadings;MMathematics;Geometry :Author: Bartman :Slug: steradian-cone-sphere A graphical representation of a steradian. It is the solid angle subtended at the center of a unit sphere by a unit area on its surface. (Wikipedia) Made by Bartman on http://golatex.de/3d-kugel-in-tikz-t17380.html The part of the cone is from http://tex.stackexchange.com/a/186109/213 \end{comment} \usepackage{sansmath} \usetikzlibrary{shadings,intersections} \begin{document} \begin{tikzpicture}[font = \sansmath] \coordinate (O) at (0,0); % ball background color \shade[ball color = blue, opacity = 0.2] (0,0) circle [radius = 2cm]; % cone \begin{scope} \def\rx{0.71}% horizontal radius of the ellipse \def\ry{0.15}% vertical radius of the ellipse \def\z{0.725}% distance from center of ellipse to origin \path [name path = ellipse] (0,\z) ellipse ({\rx} and {\ry}); \path [name path = horizontal] (-\rx,\z-\ry*\ry/\z) -- (\rx,\z-\ry*\ry/\z); \path [name intersections = {of = ellipse and horizontal}]; \end{scope} % ball \draw (O) circle [radius=2cm]; % label of ball center point \filldraw (O) circle (1pt) node[below] {$O$}; % radius \draw[densely dashed] (O) to [edge label = $1$] (-1.33,1.33); \draw[densely dashed] (O) -- (1.33,1.33); % cut of ball surface \draw[red, densely dashed] (-1.36,1.46) arc [start angle = 170, end angle = 10, x radius = 13.8mm, y radius = 3.6mm]; \draw[red] (-1.29,1.52) arc [start angle=-200, end angle = 20, x radius = 13.75mm, y radius = 3.15mm]; % label of cut of ball surface \draw (-1.2,2.2) -- (-0.23,1.1) node at (-1.37,2.37) {$B$}; \end{tikzpicture} \end{document} I want to add an angle alpha like this: How can I do this?

  • Transform Shape not working - TikZ
    by alegasalv on February 19, 2016 at 2:04 pm

    I'm trying to scale the whole picture but it's not working. \begin{tikzpicture} [scale=0.5, every node/.style={transform shape}] \tikzstyle{startstop} = [ellipse, draw=orange, thick, fill=orange!20, text width=5em, minimum height=4em, text centered, dashed] \tikzstyle{block} = [rectangle, draw=blue, thick, fill=blue!20, text width=8em, minimum height=4em, shape aspect=2, text centered, rounded corners] % Define nodes in a matrix \matrix [column sep=10mm, row sep=7mm] { \node [startstop] (Signal) {Trama de la señal}; &\node [block] (DFT) {Transformada Discreta de Fourier}; &\node [block] (Module) {Módulo}; &\node [block] (MelFilt) {Filtros Mel}; \\ \node [startstop] (MFCC) {MFCC}; &\node [block] (Lifter) {Lifter}; &\node [block] (IDCT) {Transformada Discreta Inversa de Coseno}; &\node [block] (Log) {Logaritmo}; \\ }; \node [draw, scale=1, rectangle, dashed, thick, fit=(DFT) (Module) (Log) (Lifter) (IDCT)] {}; % connect all nodes DFT above \begin{scope} [every path/.style={line, line width=1.3pt} ] %Down Lines \path (Signal) -- (DFT); \path (DFT) -- (Module); \path (Module) -- (MelFilt); \path (MelFilt.south) -- (Log.north); \path (Log) -- (IDCT); \path (IDCT) -- (Lifter); \path (Lifter) -- (MFCC); \end{scope} \end{tikzpicture} And when I replace transform shape for scale=0.5, the fitting fails.

  • Problems at page boundaries trying to highlight `\lstinline`
    by JLDiaz on July 15, 2013 at 5:05 pm

    I was trying the code given in Colored background in inline listings, which is actually the same than in How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets?, and I ran into the following problem. When the paragraph in which the \lstinline appears is broken among pages, the highlight goes to the wrong page (not always). It also happens even if the paragraph is not broken, when latex footnotes or floating mechanism interferes and sends that paragraph to the next page. The following MWE shows both problems. It is the same code than in the cited answers, with some more text before the example which causes the problem for the first case (page-break at the paragraph). You can uncomment the line with the footnote, near \begin{document}, to see also the second problem (the whole paragraph goes to the next page, but the highlight remains in the first page). \documentclass[a4paper]{article} \usepackage{etoolbox} \usepackage{atbegshi,ifthen,listings,tikz} \usepackage{lipsum} % change this to customize the appearance of the highlight \tikzstyle{highlighter} = [ yellow,% set the color for inline listings here. line width = \baselineskip, ] % enable these two lines for a more human-looking highlight %\usetikzlibrary{decorations.pathmorphing} %\tikzstyle{highlighter} += [decorate, decoration = random steps] % implementation of the core highlighting logic; do not change! \newcounter{highlight}[page] \newcommand{\tikzhighlightanchor}[1]{\ensuremath{\vcenter{\hbox{\tikz[remember picture, overlay]{\coordinate (#1 highlight \arabic{highlight});}}}}} \newcommand{\bh}[0]{\stepcounter{highlight}\tikzhighlightanchor{begin}} \newcommand{\eh}[0]{\tikzhighlightanchor{end}} \AtBeginShipout{\AtBeginShipoutUpperLeft{\ifthenelse{\value{highlight} > 0}{\tikz[remember picture, overlay]{\foreach \stroke in {1,...,\arabic{highlight}} \draw[highlighter] (begin highlight \stroke) -- (end highlight \stroke);}}{}}} %-------------------------- \makeatletter % Redefine macros from listings package: \newtoggle{@InInlineListing}% \togglefalse{@InInlineListing}% \renewcommand\lstinline[1][]{% \leavevmode\bgroup\toggletrue{@InInlineListing}\bh % \hbox\bgroup --> \bgroup \def\lst@boxpos{b}% \lsthk@PreSet\lstset{flexiblecolumns,#1}% \lsthk@TextStyle \@ifnextchar\bgroup{\afterassignment\lst@InlineG \let\@let@token}% \lstinline@}% \def\lst@LeaveAllModes{% \ifnum\lst@mode=\lst@nomode \expandafter\lsthk@EndGroup\iftoggle{@InInlineListing}{\eh{}}{}% \else \expandafter\egroup\expandafter\lst@LeaveAllModes \fi% } \makeatother \lstset{backgroundcolor=\color{green!10}}% \begin{document} \lipsum[1-5] % Foo\footnote{\lipsum[6]} This is a somewhat large paragraph which latex perhaps will break among two pages. Hopefully this will show the intended problem, that is, that the highligthed yellow box is shown in the page in which the paragraph started, instead of the page in which the code actually landed. Some more sentences to fill the required space will do. Blah, blah, lorem ipsum or whatever. This is a test where \lstinline{A=1} should have a yellow background. This, on the other hand, actually works: \begin{lstlisting}[backgroundcolor=\color{green}] A = 1 \end{lstlisting} \end{document} This is the result (after compiling twice). The yellow box near "ipsum" should be on the A=1 inline code of the second page. Can this be fixed?

  • Size of TikZ ellipse node
    by Rubens on March 21, 2013 at 2:45 am

    When I set the minimum size of an ellipse in a tikzpicture environment, it expands into a circle if the inner content does not grow as large as the ellipse shape itself. Is there any way around it? \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \usetikzlibrary{arrows} \usetikzlibrary{shapes} \tikzstyle{every node}=[draw, ellipse, minimum size=100pt, align=center] \node (a) {Alpha}; \node[left=150pt, below=30pt] (b) at (a) {Beta}; \end{tikzpicture} \end{document} It seems to me that, without something as wide as the ellipse length, TikZ is not able to define the width and height of the ellipse, but how can I set these variables?

  • Different background colors for lstinline
    by projetmbc on April 7, 2012 at 12:09 am

    In the following code, I've decided to use the code from Colored background in inline listings so as to redefine \verb to have the possibility to use colors for the text and the background of the verbatim text. The problem I meet is that only one color for the background can be used by page and I would like to have different background colors in the same page. This is surely the consequence of the use of the style: \tikzstyle{highlighter} = [% \bck@color, % line width = 0.9\baselineskip% ] What are the changes to do in the following code? Another question: is it possible to have a border rule with also a customizable color? % Two compilations must be done ! \documentclass{article} \usepackage[utf8]{inputenc} % == EXTRA == % \setlength{\parindent}{0cm} % == PACKAGES USED == % \usepackage{xargs} \usepackage{etoolbox} \usepackage{atbegshi} \usepackage{ifthen} \usepackage[svgnames,x11names]{xcolor} \usepackage{tikz} \usepackage{listings} % == DEF : Verbatim with color option == % \definecolor{colorCodeNormal}{named}{black} \definecolor{colorCodeBack}{named}{Snow2} \lstset{backgroundcolor=\color{colorCodeBack}}% \makeatletter \newcounter{highlight}[page] \newcommand{\tikzhighlightanchor}[1]{% \ensuremath{% \vcenter{% \hbox{% \tikz[remember picture, overlay]{ \coordinate (#1 highlight \arabic{highlight}); }% }% } }% } \newcommand{\bh}[0]{\stepcounter{highlight}\tikzhighlightanchor{begin}} \newcommand{\eh}[0]{\tikzhighlightanchor{end}} \AtBeginShipout{% \AtBeginShipoutUpperLeft{ \ifthenelse{\value{highlight} > 0}{\tikz[remember picture, overlay]{\foreach \stroke in {1,...,\arabic{highlight}} \draw[highlighter] (begin highlight \stroke) -- (end highlight \stroke);}}{} } } \newtoggle{@InInlineListing}% \togglefalse{@InInlineListing}% \renewcommand\lstinline[1][]{% \leavevmode\bgroup\toggletrue{@InInlineListing}\bh % \hbox\bgroup --> \bgroup \def\lst@boxpos{b}% \lsthk@PreSet\lstset{flexiblecolumns,#1}% \lsthk@TextStyle \@ifnextchar\bgroup{\afterassignment\lst@InlineG \let\@let@token}% \lstinline@}% \def\lst@LeaveAllModes{% \ifnum\lst@mode=\lst@nomode \expandafter\lsthk@EndGroup\iftoggle{@InInlineListing}{\eh{}}{}% \else \expandafter\egroup\expandafter\lst@LeaveAllModes \fi% } \renewcommand\verb{% \@ifstar{% \lstset{% showspaces=true,% showtabs=true% }% \@verbItInColor% }{% \lstset{% showspaces=false,% showtabs=false%% }% \@verbItInColor% }% } \newcommandx\@verbItInColor[2][% 1=colorCodeNormal,% 2=colorCodeBack ]{% \ifx\relax#1\relax \edef\txt@color{colorCodeNormal}% \else \edef\txt@color{#1}% \fi \ifx\relax#2\relax \edef\bck@color{colorCodeBack}% \else \edef\bck@color{#2}% \fi \lstset{basicstyle=\ttfamily\color{\txt@color}}% \tikzstyle{highlighter} = [% \bck@color, % line width = 0.9\baselineskip% ] \lstinline% } \makeatother \begin{document} % On this first page there is a problem. \verb+NORMAL+ \verb[blue]+BLUE+ \verb[green][DarkViolet]+GREEN ON DARK VIOLET+ \verb[white][cyan]+WHITE ON CYAN+ \newpage % Here the background color is correct. \verb[white][red]+WHITE ON RED+ \newpage % Here again the backgorund color is the good one. \verb[green][DarkViolet]+GREEN ON DARK VIOLET+ \end{document}

  • Why is tikz so much slower when plotting a huge amount of data than WYSIWYG plotting tools?
    by Philipp on January 23, 2012 at 10:00 am

    I was wondering why a tikz/pgf plot of a data file containing several thousand data points needs a couple of minutes to compile while creating the same plot with a WYSIWYG plotting tool (like Grace) or spreadsheet application (like MS Excel or Origin) needs only seconds. What are the WYSIWYG applications doing differently from tikz to be so much faster?

  • Cool Text Highlighting in LaTeX
    by Andrew Starks on November 25, 2010 at 5:13 pm

    LaTeX has soul. ConTeXt, of course, has beautifully marked up "sharpie" highlighting, where you can put sweet hightligher under your text for free! In the pictured example, you can see highlights that not only highlight, but that do it with cool edges that look so good, you can smell fumes! The fearless author says he'll show how that was done in another post; this one shows only how to lay down a straight, yellow box. But, it is possible to do word-wrapped highlighting with cool-shapped boxes within ConTeXt, presumably. The trouble for me is that getting into the ConTeXt world is steep climb right now, given the state of documentation and the flux of changes, so I need to continue with LaTeX. But the real problem is that now I can't live without the Organic-Looking Highlights of Awesomeness in that picture! As I said, Non-Organic-Looking Highlights of the Ordinary are easy with the soul package: \hl{Some awesome text that word wraps fine.} It just taunts me on the page with its straight lines. So, if I sacrifice word wrapping, I can use PGF/TiKz and create the following macro: \newcommand\hl[1]{% \tikz[baseline,% decoration={random steps,amplitude=1pt,segment length=15pt},% outer sep=-15pt, inner sep = 0pt% ]% \node[decorate,rectangle,fill=navcolor,anchor=text]{#1\xspace};% }% Which creates something like this: Now, my color is too dark and my randomness needs adjusting, but you see that a similar effect could be achieved. My trouble is that I don't understand TeX enough to dig into the Soul package and add the TiKz/PGF goodness that it so sorely needs. So, I leave it to you guys. Anyone want to tackle this? Or is it yet another piece of fruit, just a touch out of reach, that shall have to wait until ConTeXt settles down?