TikZ
- Extra kerning between CJK characters but not latin letters with `text width` in TikZ?by Explorer on November 21, 2026 at 4:24 pm
Let's see the following code: \documentclass[tikz,border=5pt]{standalone} \usepackage[fontset=fandol]{ctex} \begin{document} \tikz\node[draw,rectangle,text width=4cm,align=center]{你好世界}; \tikz\node[draw,rectangle,minimum width=4cm]{你好世界}; \tikz\node[draw,rectangle,text width=4cm,align=center]{XXX}; \tikz\node[draw,rectangle,minimum width=4cm]{XXX}; \end{document} No matter with xelatex nor lualatex, with TL2026, gives: What caused the extra spacing around the CJK characters 「你好世界」? Could the extra kerning be avoided?
- Cannot move a node in the axis environmentby kronenbouh on November 21, 2026 at 4:13 pm
I draw a simple graph using tikz and the axis environment. I placed a node to indicate the name of the function, however the argument "pos" does not seem to have any impact on the actual position of the node. I cannot figure out why. Below is a minimal compilable code. \documentclass[tikz,border=3mm]{standalone} \usepackage{pgfplots} \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[ xmin = -0.2, xmax=11.2, ymin=-0.2, ymax=620, axis x line=middle, axis y line=middle, axis line style=->, grid=both, grid style = {opacity=.5}, xtick={0, 1, ..., 11}, ytick={0, 50, ..., 600}, clip=true, x=1cm, y=0.01cm, ] \addplot[no marks, black, -, thick] expression[domain=0:11, samples=101]{(-22*x^2+220*x+50}; node[pos=0.8, above right] {$f$}; \end{axis} \end{tikzpicture} \end{center} \end{document} Thank you for your help.
- Using scope to do an affine transformation of a polygonby kronenbouh on November 20, 2026 at 1:23 pm
I'm currently inserting a tikzpicture in my latex document, my code is below: \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{center} \begin{tikzpicture}[scale=0.6] \draw[xstep=1cm, ystep=1cm, gray!30] (0,0) grid (15,7); \coordinate (A) at (1,1); \coordinate (B) at (1,6); \coordinate (C) at (4,6); \coordinate (D) at (4,4); \coordinate (E) at (2,3); \coordinate (F) at (4,2); \coordinate (G) at (4,1); \foreach \P [remember=\P as \lastP (initially A)] in {A,...,G,A} { \draw[black] (\lastP) -- (\P); } % the part i'm struggling with \begin{scope}[cm={-1,0,0,1,(8,0)}] \foreach \P [remember=\P as \lastP (initially A)] in {A,...,G,A} { \draw[black] (\lastP) -- (\P); } \end{scope} \end{tikzpicture} \end{center} \end{document} I would like to draw the symmetric of the (A) to (G) polygon along the (CG) axis. My code produces the original polygon but not the transformed one. Could someone help me fix this issue?
- nicematrix, \CodeAfter and overlappingby projetmbc on December 25, 2025 at 11:11 am
Is there an automatic way to avoid "TikZ code after" overlap the text? I give a real use case, and not a MWE. \documentclass[12pt]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[top=1cm, bottom=1.95cm, left=.9cm, right=.9cm]{geometry} \usepackage{nicematrix} \usepackage[svgnames]{xcolor} \usepackage{tikz] \tikzset{ product/.style = { shorten > = 3.75mm, thick }, product-times/.style = { pos=0.5, circle, fill=white, inner sep=2pt }, arrow/.style = { ->, thick }, rounded-frame/.style = { draw, rounded corners, thick, inner sep = 5pt, anchor = west } } \begin{document} XXX $\begin{NiceArray}{*{9}{c}}[cell-space-limits=3pt] & & & & & & & & C_j^{\,\prime} \\ & & & & & & & & \phantom{X} \\ & & & & & & & & \Vdots[shorten-start=11pt] \\ & & & & & & & & \color{IndianRed}a[k]_{qj} \\ & & & & & & & & \Vdots \\ & & & & & & & & \color{ForestGreen} a[k]_{rj} \\ & & & & & & & & \Vdots[shorten-end=21pt] \\ & & \NotEmpty & & & & \NotEmpty & & \\ L_i & \hspace{3pt} & \Cdots[shorten-start=18pt] & \color{IndianRed} 1 & \Cdots & \color{ForestGreen} 0 & \Cdots[shorten-end=18pt] & \hspace{12.5pt} & a[k{+}1]_{ij} % \CodeAfter % Sous-matrices. \SubMatrix({3-9}{7-9})[slim] \SubMatrix({9-3}{9-7}) \SubMatrix({9-9}{9-9}) % Décorons... \begin{tikzpicture} % Indication pour la ligne et la colonne. \draw[ arrow, shorten > = 8mm, ] (1-9.south) to (4-9.north); \draw[ arrow, shorten < = 1mm, shorten > = 9.5mm, ] (9-1.east) to (9-4.west); % Flèches des produits. \draw[ product, IndianRed, ] (9-4.north) to [bend left] node[ product-times, draw = IndianRed, ] {$\times$} (4-9.west); \draw[ product, ForestGreen, ] (9-6.north) to [bend left] node[ product-times, draw = ForestGreen ] {$\times$} (6-9.west) ; % Signification des entrées. \draw[ arrow, ForestGreen, ] ([yshift=-5mm]9-6.south) to (9-6.south); \node[ rounded-frame, ForestGreen ] at ([yshift=-8.1mm, xshift=-2mm]9-6.south) {Pas de lien direct de $i$ à $r$.}; % \draw[ arrow, IndianRed, ] ([yshift=-13.5mm]9-4.south) to (9-4.south); \node[ rounded-frame, IndianRed ] at ([yshift=-17mm, xshift=-2mm]9-4.south) {Un lien direct de $i$ à $q$.}; % \draw[ arrow, IndianRed ] ([xshift=8.5mm] 4-9.east) to ([xshift=3.5mm] 4-9.east); \node[ rounded-frame, IndianRed, ] at ([xshift=8.5mm] 4-9.east) {Nombre de parcours de longueur $k$ de $q$ à $j$.}; % \draw[ arrow, ForestGreen, ] ([xshift=8.5mm] 6-9.east) to ([xshift=3.5mm] 6-9.east); \node[ rounded-frame, ForestGreen, ] at ([xshift=8.5mm] 6-9.east) {Nombre de parcours de longueur $k$ de $r$ à $j$.}; \end{tikzpicture} \end{NiceArray}$ XXX \end{document}
- What is the most elegant way to shift the xy-plane to 𝑧=0 in a 3D TikZ diagram?by Marco Moldenhauer on June 28, 2025 at 3:42 am
I'm trying to draw a 3D diagram, and I want the xy-plane of the coordinate system to appear at z=0 — in effect, "lifting" the standard xy-plane to a higher position in the 3D coordinate space, as shown in the image below. What would be the most elegant and idiomatic way to achieve this? my code \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} [ % Define a paremtric curve declare function = { fx(\t) = 0.25+\t^3; fy(\t) = 0.5+1.6*\t; fz(\t) = 1-\t^2; Samples = 8; DomLowerBound = 0; DomUpperBound = 1.2; }, ] \begin{axis} [%% view={120}{45}, plot box ratio=1 1 1, width=22cm, height=12cm, xmin=-0.5, xmax=2.5, ymin=-0.5, ymax=2.5, zmin=-1, zmax=1.5, grid, grid style={very thin, gray}, trig format plots=rad, enlargelimits=false, xlabel=$x$, ylabel=$y$, zlabel=$z$, xtick={0.0,0.5,...,2}, ytick={0.0,0.5,...,2} ]%% % Plot the parametric surface using the defined functions \addplot3 [ variable=t, mesh, domain=DomLowerBound:DomUpperBound, samples=Samples ] ( { fx(t) }, { fy(t) }, { fz(t) } ); \addplot3 [ variable=t, mesh, domain=DomLowerBound:DomUpperBound, samples=Samples, gray ] ( { fx(t) }, { fy(t) }, { -1 } ); \pgfplotsinvokeforeach {0,DomUpperBound/(Samples-1),...,DomUpperBound} { \draw[gray, dotted] ({fx(#1)},{fy(#1)},-1) -- ({fx(#1)},{fy(#1)},{fz(#1)}); } \end{axis} \end{tikzpicture} \end{document} my output
- pgfmath function with loop not supported by addplotby Yijun Yuan on February 22, 2025 at 8:35 am
The following code \documentclass{article} \usepackage{pgfplots} \usetikzlibrary{math} \begin{document} \begin{tikzpicture} \tikzmath{ function test(\x,\y){ \res=0; for \z in {1,...,3} { \res=\res+\x+\y; }; return \res; }; } \begin{axis} \addplot3[surf,variable=\x,variable y=\y]({\x},{\y},{test(\x,\y)}); \end{axis} \end{tikzpicture} \end{document} will give error Illegal unit of measure (pt inserted). <to be read again> Y l.21 ...=\x,variable y=\y]({\x},{\y},{test(\x,\y)}); while the code \documentclass{article} \usepackage{pgfplots} \usetikzlibrary{math} \begin{document} \tikzmath{ function test(\x,\y){ \res=0; for \z in {1,...,3} { \res=\res+\x+\y; }; return \res; }; \res = test(1,2); print{\res}; } \end{document} works as expected (prints 9.0). Why is that? (This function is just a MWE, so rather than replacing test(\x,\y) with (\x+\y)*3, I'd like to know the reason behind this error)
- Drawing rods at various positions and angles along a parabolaby Ismael Joaquim on February 6, 2025 at 10:40 am
\documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} % Define the parabola \coordinate (A) at (0,4); % Vertex of the parabola \coordinate (B) at (-3,0); % Left endpoint \coordinate (C) at (3,0); % Right endpoint \draw[thick] (A) parabola (B); % Draw left half of the parabola \draw[thick] (A) parabola (C); % Draw right half of the parabola % Draw a dashed grid for reference \draw[dashed, step=0.5] (-3,0) grid (3,4); % Define the length of the rod \def\rodLength{1.5} % Length of the rod % Draw the rod at various positions along the parabola \foreach \x in {-2.5, -1.5, -0.5, 0.5, 1.5, 2.5} { % Calculate the y position on the parabola using the equation y = 4 - (x^2)/2.25 \pgfmathsetmacro{\y}{4 - (\x * \x) / 2.25} % Calculate the slope of the parabola at this point (dy/dx = -x/1.125) \pgfmathsetmacro{\slope}{-\x / 1.125} % Calculate the rotation angle for the rod (in degrees) \pgfmathsetmacro{\angle}{atan(\slope)} % Draw the rod (thick blue line) rotated at the calculated angle \draw[line width=2mm, color=blue, rotate around={\angle:(\x,\y)}] (\x - \rodLength/2, \y) -- (\x + \rodLength/2, \y); % Mark the center of mass (red dot) \filldraw[red] (\x, \y) circle (2pt); } \end{tikzpicture} \end{document} Current result:
- How to change the canvas size of nicematrixby Felix Benning on November 18, 2024 at 8:43 am
The following use of the package nicematrix cuts of the arrows below the matrix. In most documents (not standalone) this can be solved with a manual \vspace but I wonder how you can adjust the actual canvas size. \documentclass{standalone} \usepackage{nicematrix} \usepackage{xcolor} \usepackage{tikz, tikz-cd, pgfplots} % plots and sketches \usetikzlibrary{positioning} \usepackage{mathtools} \newcommand*{\activation}{\psi} \DeclareMathOperator{\sigmoid}{sigmoid} \begin{document} \begin{NiceTabular}{ *{6}{c} }[corners, hvlines] \Block{1-6}{All possible parameters}\\ \Block{1-2}{Efficient} & & \Block{1-4}{Redundant} & & & \\ Polynomially efficient & ? & \Block{1-3}{General redundant} &&& Activation \\ & & Deactivation & Bias & Duplication & Symmetry \\ \CodeAfter % \TikzEveryCell{offset=1pt,draw} \tikz \node[below=4em of 3-1, align=center,xshift=-1em] (isolated) {isolated crit.\ points\\ (Theorem~\ref{thm: morse function on efficient networks})}; \tikz \draw[-Stealth] (3-1.south) -- node[fill=white,align=center,text=black!70] {a.s.\\for MSE} (isolated) ; \tikz \node[below=6em of 3-2, align=center] (not_poly_efficient) {empty set\\ (Theorem~\ref{thm: characterization of efficient networks})}; \tikz \draw[-Stealth] (3-2.south) -- node[fill=white,text=black!70] {\(\activation\in \{\substack{\sigmoid\\\tanh}\}\)} (not_poly_efficient); \tikz \node[below=3.3em of 4-4.south, align=center] (not_exists) {crit. points do not exist\\(Proposition~\ref{prop: bias red do not exist})}; \tikz \draw[-Stealth] (4-4.south) -- node[fill=white,align=center,text=black!70] {a.s. for MSE} (not_exists); \tikz \node[below=5em of 4-6.south, anchor=north, align=center,text=black!70] (not_isolated) {crit. points never isolated\\(Theorem~\ref{})}; \tikz \draw[-Stealth] (4-5.south) -- (not_isolated); \tikz \draw[-Stealth] (4-6.south) -- node[fill=white,xshift=1em,text=black!70] {\(\activation\in \{\substack{\sigmoid\\\tanh}\}\)} (not_isolated); \end{NiceTabular} \end{document}
- Why does \node work inside an axis environment while \pgfpointanchor fails?by cjorssen on November 14, 2024 at 10:47 pm
Consider the following code, where a node named A is defined inside an axis environment at the end of an \addplot macro. \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot coordinates {(0, 0) (1, 1)} node[pos = .5, sloped, above] (A) {to}; % Does not work here % \pgfmathanglebetweenpoints{\pgfpointanchor{A}{south west}}{\pgfpointanchor{A}{south east}} \node[rotate = 0, red] at (A) {YO}; \end{axis} % Works here % \pgfmathanglebetweenpoints{\pgfpointanchor{A}{south west}}{\pgfpointanchor{A}{south east}} \end{tikzpicture} \end{document} The low-level pgf command \pgfpointanchor does work outside of axis environment but does not work inside (the error I get is No shape named A is known). If I understand correctly, this is not surprising since pgfplots needs to process all the plots to compute the dimensions of the axis and then determine the coordinates of the node. What I don't understand is why the \node at (A) command works inside the axis environment. Could someone explain this behavior?
- Error with using Forest and Tikz externalizationby 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 picturesby 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}
- Svg to Tikz doesn't workby Mohamed Hasnaoui on June 6, 2020 at 1:41 pm
I'm using inkscape to draw a simple picture and i saved with svg extension I want to convert this svg file to Tikz code for latex I download the extensions from github https://github.com/paaguti/svg2tikz and i Extract the files tikz_export.py, tikz_export_effect.inx, and tikz_export_output.inx from svg2tikz-master/svg2tikz/extensions and put them in the share/extension directory inside the Inkscape installation directory. when i chose extension->exporter->export to tikz path i get this message and nothing happen; Inscape a reçu des données additionnelles du script exécuté. Le script n’a pas retourné d’erreur, mais ceci peut indiquer que les résultats ne sont pas ceux attendus. tikz_export.py:645: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar. parser = self.OptionParser Traceback (most recent call last): File "tikz_export.py", line 1478, in main_inkscape() File "tikz_export.py", line 1461, in main_inkscape effect = TikZPathExporter(inkscape_mode=True) File "tikz_export.py", line 629, in init self._set_up_options() File "tikz_export.py", line 646, in _set_up_options parser.set_defaults(codeoutput='standalone', crop=False, clipboard=False, AttributeError: 'TikZPathExporter' object has no attribute 'set_defaults'
- pgfmath fail to access the item of array that has only one itemby ZhiyuanLck on June 1, 2020 at 9:43 am
Sometimes there is only one item in the array list, and array access operator seems to get only the first character of the element in this case. How to fix it? \documentclass[tikz, border=1cm]{standalone} \begin{document} \begin{tikzpicture} \node at (0, 0) {\pgfmathparse{{0.3}[0]}\pgfmathresult}; \node at (1, 0) {\pgfmathparse{{13}[0]}\pgfmathresult}; \node at (2, 0) {\pgfmathparse{{"abc"}[0]}\pgfmathresult}; \node at (3, 0) {\pgfmathparse{{12pt}[0]}\pgfmathresult}; \end{tikzpicture} \end{document}
- Shading Region of a Graphby James Evershed on April 7, 2020 at 10:02 am
Hope you're safe! I'm new to making graphs in pgfplots, and I've made the following graph (code below): What I'd like to do is to shade the area of the graph corresponding to all the points which lie above the black, red, and green lines, but within the co-ordinates' domain and range. Does anyone know how to do this? Thanks! \documentclass[12pt]{article} \usepackage{tikz-cd} %diagrams \usepackage{pgfplots} %graphs \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[ scaled ticks=false, width=14.9cm, xmin=0,xmax=0.1, ymin=0,ymax=0.1, axis x line=middle, axis y line=middle, axis line style= ->, xlabel={$\delta_{I}$}, ylabel={$\delta_{D}$}, y tick label style={ /pgf/number format/.cd, fixed, fixed zerofill, precision=2, /tikz/.cd }, x tick label style={ /pgf/number format/.cd, fixed, fixed zerofill, precision=2, /tikz/.cd }, x label style={at={(axis description cs:1,-0.1)},anchor=north}, y label style={at={(axis description cs:-0.1,1)},anchor=south}, ] \addplot expression[black,mark=none,domain=0:.1,very thick]{x} node[pos=0.95,anchor= south east]{$\delta_{D}=\delta_{I}$}; \addplot expression[red,mark=none,domain=0:.1,very thick]{9/13*x+4/195} node[pos=0.75,anchor= north west]{$\delta_{D}=\frac{9}{13}\delta_{I} + \frac{4}{195}$}; \addplot expression[blue,mark=none,domain=0:.1,very thick]{-1/2*x+1/30} node[pos=0.5,anchor= south west]{$\delta_{D}=-\frac{1}{2}\delta_{I}$ + $\frac{1}{30}$}; \addplot expression[green,mark=none,domain=0:.1,very thick]{-2*x+1/15} node[pos=0.05,anchor= south west]{$\delta_{D}=-2\delta_{I} + \frac{1}{15}$}; \end{axis} \end{tikzpicture} \end{center} \end{document}
- Positioning tikz arrows to coordinates inside tabularsby Marc Kees on August 22, 2019 at 8:40 pm
I need to create a slide with multiple tabulars and use arrow to point to elements inside those tabulars. However, I'm having trouble to specify where tabulars, texts and arrows should appear. How can I do this? My minimal non-working example follows: \documentclass{beamer} % only frames \usepackage{tikz} \usetikzlibrary{shapes.geometric,positioning,matrix} \newcommand{\tikzmark}[1]{\tikz[remember picture] \node[coordinate] (#1) {#1};} \begin{document} \begin{frame}\frametitle{Example} \begin{tabular}{ccccc} \tikzmark{col1} \begin{tabular}{|c|}\hline \tikzmark{elem1}2\\\hline 3\\\hline 7\\\hline 6\\\hline 1\\\hline 5\\\hline 4\\\hline \end{tabular}& \tikzmark{col2} \begin{tabular}{|c|}\hline \tikzmark{elem2}4\\\hline 2\\\hline 1\\\hline 3\\\hline 6\\\hline 7\\\hline 5\\\hline \end{tabular}& \tikzmark{mat} \begin{tabular}{|c|c|c|c|}\hline 1&0&1&0\\\hline 1&0&0&1\\\hline 0&1&0&1\\\hline 0&1&0&1\\\hline 0&1&0&1\\\hline 1&0&1&0\\\hline 1&0&1&0\\\hline \end{tabular}& \tikzmark{sigMat} \begin{tabular}{|c|c|c|c|}\hline \tikzmark{elem3}2&1&2&1\\\hline 2&1&4&1\\\hline 1&2&1&2\\\hline \end{tabular} \end{tabular} \begin{tikzpicture}[remember picture] \node [above=.01cm of col2] {\tiny Text Above columns}; \node[above=.01cm of mat] {\tiny Above 1st matrix}; \node[above=.1cm of sigMat]{\tiny Above 2nd matrix}; \node[above=2cm of mat,text width=6cm] (txt1) {Arrows go from here to...}; \path[draw,->] (txt1.south west) -- node {goes to 1st elem} (elem1); \path[draw,->] (txt1.south) -- node {goes to 2nd elem} (elem2); \path[draw,->] (txt1.south east) -- node {goes to 3rd elem} (elem3); \end{tikzpicture} \end{frame} \end{document} This results in the following slide:
- `imshow` like diplay of image with colormapby Manuel Schmidt on January 15, 2019 at 5:39 pm
I would like to show an originally gray scale image with a specific colormap like matlabs/matplotlibs imshow. Original: % python import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np img=mpimg.imread('stinkbug.png') imgplot = plt.imshow(img) plt.imshow(img, cmap="hot") Is this possible with tikz or pgfplots? I can export the image to csv or any other format if necessary. However I would like to specify the colormap in latex/tikz/pgfplots and not export an already colored image from python.
- How can I draw a sphere knowing that centre and radius?by minhthien_2016 on May 6, 2017 at 1:42 pm
I want to draw a sphere with centre at O and radius is the segment OA. I can't draw it. My code is \documentclass[12pt,border=3]{standalone} \usepackage{tikz} \usepackage{tikz-3dplot} \usepackage{fouriernc} \usetikzlibrary{calc} \newcommand{\RightAngle}[4][2.5pt]{% \draw ($#3!#1!#2$) --($ #3!2!($($#3!#1!#2$)!.5!($#3!#1!#4$)$) $) --($#3!#1!#4$) ; } \begin{document} \newcommand\pgfmathsinandcos[3]{% \pgfmathsetmacro#1{sin(#3)}% \pgfmathsetmacro#2{cos(#3)}% } \begin{tikzpicture}[scale=2.5] \pgfmathsetmacro\AngleFuite{135} \pgfmathsetmacro\coeffReduc{.8} \pgfmathsetmacro\clen{2} \pgfmathsinandcos\sint\cost{\AngleFuite} \begin{scope} [x = {(\coeffReduc*\cost,-\coeffReduc*\sint)}, y = {(1cm,0cm)}, z = {(0cm,1cm)}] \path coordinate (O) at (0,0,0) coordinate (A) at (0,0,0) coordinate (B) at (1,0,0) coordinate (C) at (1,{sqrt(3)},0) coordinate (D) at (0,{sqrt(3)},0) coordinate (S) at (0,0,2) coordinate(H) at (4/5,0,2/5) coordinate(K) at (0,{4*sqrt(3)/7},6/7) coordinate(O) at (1/2,{sqrt(3)/2},0) ; \draw[thick] (C)--(K) ; \draw[ dashed] (A)--(B) (A)--(D) (A)--(K) (A)--(S) (A)--(H) (A)--(C) (B)--(D) ; \end{scope} \foreach \v/\position in {A/below,B/below,C/below,D/right,S/above,H/left,K/right,O/below} { \draw[fill=black] (\v) circle (0.7pt) node [\position=0.2mm] {$\v$}; } \draw [fill opacity=0.4,fill=green!80!blue] (S) -- (B) -- (C) -- cycle; \draw [fill opacity=0.4,fill=orange!80!blue] (S) -- (C) -- (D) -- cycle; \RightAngle{(C)}{(K)}{(A)}; \RightAngle{(S)}{(H)}{(A)}; \end{tikzpicture} \end{document}
- PGFPlots fillbetween layer issue with main layerby bz-mof on April 6, 2017 at 9:02 pm
I am using fill between to create some diagrams where I need semi-transparent fillings above ploted lines. As normally fillings are put into a separate layer pre main below plot lines, I tried to move the fillings via on layer=main. They disappear? I don't know if this behaviour is intended. I can draw them on any other layer but this one. See the minimal example below: \documentclass[]{article} \usepackage{pgfplots} \pgfplotsset{compat=1.14} \usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture} \begin{axis} \addplot+[name path=A,domain=0:1,samples=10] {x}; \addplot+[name path=B,domain=0:1, samples=10] {x^2}; \addplot fill between[of=A and B, on layer=main]; \end{axis} \end{tikzpicture} \end{document} Result My workaround at the moment is to draw everything onto the pre main layer. Edit: Giving the option in the \addplot part of the statement has absolutely no effect: \documentclass[]{article} \usepackage{pgfplots} \pgfplotsset{compat=1.14} \usepgfplotslibrary{fillbetween} \begin{document} \begin{tikzpicture} \begin{axis}[domain=0:1] \addplot+[name path=A, draw=none, mark=none] {x}; \addplot+[name path=B, draw=none, mark=none] {x^2}; \addplot+[draw=black, mark=none] {x-0.1}; \addplot [on layer=axis foreground, fill=green] fill between[of=A and B]; \addplot+[draw=blue, mark=none] {x-0.15}; \end{axis} \end{tikzpicture} \end{document} Result
- How to draw a 2D vector field in pgfplots?by ILoveJesus on January 26, 2017 at 8:43 pm
I'm pretty new to LaTeX and I need to draw a 2D vector field (Like a graph with vector arrows all over it. I can't find it anywhere online. I'd like to use pgfplots if that's possible.
- Shaded 3D ellipsoid with pgfplotby Tyrion on August 13, 2015 at 12:01 pm
I'm trying to display a shaded 3D ellipsoid with axis labels with PGFplots. So far I achieved this. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots,tikz-3dplot} \begin{document} \begin{tikzpicture} \begin{axis}[% width=0.8\textwidth, axis equal, axis lines = center, y label style={at={(axis cs:0,2,0)},anchor=west}, xlabel = {$\lambda_1,\ \vec{e}_1$}, ylabel = {$\lambda_2,\ \vec{e}_2$}, zlabel = {$\lambda_3,\ \vec{e}_3$}, ticks=none, ] \addplot3[% shader=interp, opacity = 0.3, fill opacity=0.3, surf, colormap/blackwhite, variable = \u, variable y = \v, domain = 0:180, y domain = 0:360, ] ({2*cos(u)*sin(v)}, {2*sin(u)*sin(v)}, {0.5*cos(v)}); \end{axis} \end{tikzpicture} \end{document} The result looks like this: This shading does not give a 3D impression, I would like to have somethin like this: Is it possible to define a new 3d shading in this coordinate system? I could not find such a command in the pgfplot documentation. All predefined shadings are not suitable. Glad for any help!
- Diagram reuse across Beamer slidesby Aleksandr Blekh on March 28, 2015 at 7:08 pm
In my dissertation defense presentation (Beamer/TikZ), I have a particular slide with a model, built as tikzpicture, wrapped in a scalebox block for zoom control. It works fine. However, I would like to reuse this diagram's code in another slide further in the presentation to display a smaller version of the same model (along with a text block) for reference, in order to avoid the need to navigate multiple slides backward and forward again. This is quite important, because: 1) I plan to use a presenter device (remote), which makes such transitions not feasible; 2) I don't want to abruptly switch the context and disrupt the flow of my presentation. Ideally, I would like to define the model as LaTeX variable and refer to it in both places with different zoom levels, using scalebox. Is such reuse possible and, if yes, how could I do that?
- Parabolic Moebius map on sphere using tikzby sheik yerbouti II on September 2, 2014 at 6:06 pm
There is a discussion here about coding the elliptic Moebius map. I however am interested in how I might do the parabolic one. case [d] The arrow heads are not an issue, but how do I get the lines on the surface of the sphere? Most (all?) tutorials only focus on lines of latitude and longitude)
- pgfplots 3d cylindrical coordinate systemby Markus on March 31, 2014 at 3:16 am
I am trying to plot a cylindrical coordinate system using pgfplots. The idea would be to plot the r,theta plane similar to what polaraxis provides, see here. I don't know how to translate something like this into a 3D environment. Is there an easy way to plot a custom coordinate system within the current 3D axis? UPDATE: I may not have been precise enough. I am specifically interested in plotting the coordinate/axis system, i.e. the r,theta grid in a 3D plot.
- Help creating solid cylinders along a path in Tikz for crystal lattice diagramby shane on May 17, 2013 at 4:55 pm
I am trying to draw a diagram using Tikz that will show the crystalline lattice structure of diamond. It should look like the following illustration (reference). I have managed to figure out the locations of each of the carbon atoms. I defined each of those locations as a coordinate (A, B, ... Q) and I managed to draw the atoms, but I don't like the look of the lines that show which atoms are connected. My problem is that the lines are not distinct enough from one another. Instead of plain lines I would like to draw three dimensional cylinders that connect the atoms together as I think that would make the image look much better. I have no idea how to get Tikz to do this, however. Here's what I've got so far. Anybody have an idea? \documentclass[10pt]{article} \usepackage{tikz} \begin{document} \pagestyle{empty} \begin{tikzpicture}[scale = 1] %points on cube \coordinate (A) at (0,0,0); \coordinate (B) at (0,0,4); \coordinate (D) at (0,4,0); \coordinate (C) at (0,4,4); \coordinate (E) at (4,0,0); \coordinate (F) at (4,0,4); \coordinate (H) at (4,4,0); \coordinate (G) at (4,4,4); %center of faces \coordinate (I) at (0,2,2); %center of face ABCD \coordinate (J) at (4,2,2); %center of face EFGH \coordinate (K) at (2,4,2); %center of face DCGH \coordinate (L) at (2,0,2); %center of face ABFE \coordinate (M) at (2,2,4); %center of face CBGF \coordinate (N) at (2,2,0); %center of face DAEH %connectors \coordinate (O) at (1,1,3); \coordinate (P) at (1,3,1); \coordinate (Q) at (3,1,1); \coordinate (R) at (3,3,3); %place non-atom cube corners \shadedraw [ball color= gray] (A) circle (0.1cm); \shadedraw [ball color= gray] (C) circle (0.1cm); \shadedraw [ball color= gray] (F) circle (0.1cm); \shadedraw [ball color= gray] (H) circle (0.1cm); \shadedraw [ball color= black] (B) circle (0.25cm); \shadedraw [ball color= black] (D) circle (0.25cm); \shadedraw [ball color= black] (E) circle (0.25cm); \shadedraw [ball color= black] (G) circle (0.25cm); %draw the center of each face \shadedraw [ball color= red] (I) circle (0.25cm); \shadedraw [ball color= red] (J) circle (0.25cm); \shadedraw [ball color= red] (K) circle (0.25cm); \shadedraw [ball color= red] (L) circle (0.25cm); \shadedraw [ball color= red] (M) circle (0.25cm); \shadedraw [ball color= red] (N) circle (0.25cm); %connectors \shadedraw [ball color= blue] (O) circle (0.25cm); \shadedraw [ball color= blue] (P) circle (0.25cm); \shadedraw [ball color= blue] (Q) circle (0.25cm); \shadedraw [ball color= blue] (R) circle (0.25cm); %draw cube \draw [dashed] (A) -- (B); \draw [dashed] (B) -- (C); \draw [dashed] (C) -- (D); \draw [dashed] (D) -- (A); \draw [dashed] (E) -- (F); \draw [dashed] (F) -- (G); \draw [dashed] (G) -- (H); \draw [dashed] (H) -- (E); \draw [dashed] (A) -- (E); \draw [dashed] (B) -- (F); \draw [dashed] (C) -- (G); \draw [dashed] (D) -- (H); %connections from faces to O \draw [very thick] (B) -- (O); \draw [very thick] (I) -- (O); \draw [very thick] (M) -- (O); \draw [very thick] (L) -- (O); %connections from faces to P \draw [very thick] (N) -- (P); \draw [very thick] (I) -- (P); \draw [very thick] (D) -- (P); \draw [very thick] (K) -- (P); %connections from faces to Q \draw [very thick] (E) -- (Q); \draw [very thick] (J) -- (Q); \draw [very thick] (N) -- (Q); \draw [very thick] (L) -- (Q); %connections from faces to R \draw [very thick] (G) -- (R); \draw [very thick] (M) -- (R); \draw [very thick] (J) -- (R); \draw [very thick] (K) -- (R); \end{tikzpicture} \end{document}
- Diagonal text in diagonal matrixby Acorbe on April 11, 2013 at 5:07 pm
I have a tridiagonal matrix whose diagonals d_{-1}, d_0, d_1 (thought as vectors) can be written as vector expressions. Is there a way to nicely represent this, e.g. via a matrix which is blank everywhere except from the diagonals which report the expression (written diagonally) and maybe continuous lines elsewhere? (Please see the attached picture). Any help appreciated.
- Drawing 3D crystal lattice with tikz/pstricksby Iohann on February 7, 2013 at 9:56 pm
I need to draw 3D lattice of DO3 type (Ni-Mn-Al, DO3) and more complex ones. Both TiKZ and PSTricks packages draw following objects on top of previously drawn disregarding "real" 3D position. For example, on this picture 2 red atoms on the right cover white ones, when they shouldn't. \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[->] \draw (0,0) -- (4,0,0); \draw (0,0) -- (0,4,0); \draw (0,0) -- (0,0,4); \foreach \x in {1,2,3} \foreach \y in {1,2,3} \foreach \z in {1,2,3} \draw (\x,\y,\z) circle (2pt); \foreach \x in {1.5,2.5} \foreach \y in {1.5,2.5} \foreach \z in {1,2,3} \draw[gray,very thin] (\x,\y,\z) +(-.5,-.5) rectangle ++(.5,.5); \foreach \x in {1,2,3} \draw (\x,1,1) -- (\x,1,3) (\x,2,1) -- (\x,2,3) (\x,3,1) -- (\x,3,3) ; \foreach \x in {1.5,2.5} \foreach \y in {1.5,2.5} \foreach \z in {1.5,2.5} \filldraw[red] (\x,\y,\z) circle (2pt); \end{tikzpicture} \end{document} It is possible, to obtain right behavior with layers or certain order of the drawing. However for complex lattices it is very difficult and depends on view angle.
- How to draw the region of inequality?by Yichao Zhou on October 9, 2012 at 2:29 am
Everyone, I would like to draw the region \begin{align*} x_1 + x_2 &\ge 3 \\ 2x_1 - x_2 &\le 5 \\ -x_1 + 2x_2 &\le 3 \end{align*} Here is my code to draw the region of inequality: \documentclass{article} \usepackage{pgfplots} \usetikzlibrary{patterns} \begin{document} \begin{figure}[htpb] \centering \label{fig:p3:c1} \begin{tikzpicture} \begin{axis}[axis on top,smooth, axis line style=very thick, axis x line=bottom, axis y line=left, ymin=-1,ymax=6,xmin=-1,xmax=6, xlabel=$x_1$, ylabel=$x_2$,grid=major ] \addplot[thick,pattern=crosshatch,pattern color=blue!30!white, domain=-10:4]{3-x} -| (axis cs:50, 50); \addplot[thick,pattern=crosshatch dots,pattern color=green!60!white, domain=-10:12]{-5+2*x} -| (axis cs: -50,50); \addplot[thick,pattern=grid,pattern color=yellow, domain=-10:10]{3/2+x/2} -| (axis cs: 20,0); \addplot[very thick, domain=-10:10]{3-x}; \addplot[very thick, domain=-10:10]{-5+2*x}; \addplot[very thick, domain=-10:10]{3/2+x/2}; \end{axis} \end{tikzpicture} \caption{Problem 4, Part A} \end{figure} \end{document} This code have several problems. In order not let pattern to cover the line, I draw every function twice. Can we draw the pattern just before draw all the line? The grid overlap show before the line. (I also want to let axis on the top) How to fill the region above/under a curve/line? As you can see, I just use a very ugly way. It will draw unnecessary line (now it is overlapped with axis) and it is not beautiful. I need to modify the coordinate every time I change other things. Any better method?
- pgfplots quadricsby Brownian on August 9, 2012 at 10:05 pm
I wonder whether it is possible to draw the three following quadric surfaces (cone, hyperboloids) x^2+y^2-z^2=0 x^2+y^2-z^2=1 x^2+y^2-z^2=-1 (and the axis) using pgfplots 3d or TikZ as it is done in the following image
- How can I draw a vector field (quiver plot) on a torus in 3D?by Håkon Marthinsen on June 21, 2012 at 2:34 pm
I'd like to draw a vector field on a torus using PGFPlots and/or TikZ. I managed to do it using ePiX, based on the file decorate.xp from the example gallery, but then I have to do z-sorting by hand, which is very ugly. How can I get PGFPlots and/or TikZ to give the same result? It seems to me that PGFPlots can plot the vector field using quiver, and plot the torus as a surf, but not both at once. Is it possible to get around this by chopping up the drawing into smaller pieces? How should I do that? NB: The code is a hack, and is probably badly written and formatted. Any tips for improving the figure and/or code are appreciated! /* -*-ePiX code based on on the example file decorate.xp-*- */ #include <algorithm> #include "epix.h" using namespace ePiX; const int N1(60); // latitudes const int N2(60); // longitudes const double du(2*M_PI/N1); const double dv(2*M_PI/N2); const double r_0(.999); // minor radius const double R_0(1); // major radius P F(double u, double v) { return polar(R_0 + r_0*Cos(u), v) + P(0,0,r_0*Sin(u)); } namespace ePiX { class mesh_quad { private: P pt1, pt2, pt3, pt4, center; double distance; public: mesh_quad(P f(double u, double v), double u0, double v0) : pt1(f(u0,v0)), pt2(f(u0+du,v0)), pt3(f(u0+du,v0+dv)), pt4(f(u0,v0+dv)), center(0.25*(pt1 + pt2 + pt3 + pt4)), distance(max(max(max(norm(pt1-camera.viewpt()), norm(pt2-camera.viewpt())), norm(pt3-camera.viewpt())), norm(pt4-camera.viewpt()))) { } double how_far() const { return distance; } void draw() const { P direction(center-camera.viewpt()); P normal((pt2 - pt1)*(pt4 - pt1)); normal *= 1/norm(normal); fill(Gray(normal|(recip(distance)*direction))); pen(0); quad(pt1, pt2, pt3, pt4); fill(false); } }; class mesh_vf { private: P pt1, pt2, center; double distance; public: mesh_vf(P f(double u, double v), double u0, double v0) { pt1 = f(u0,v0); double C = 2 * (pt1.x2() - 8); double Gamma = -C * Sin(u0) * Sin(v0); double Delta = C * (1 + Cos(u0)) * Cos(v0); pt2 = f(u0,v0) + .005 * P(Gamma * Sin(u0) * Cos(v0) + Delta * (1 + Cos(u0)) * Sin(v0), Gamma * Sin(u0) * Sin(v0) - Delta * (1 + Cos(u0)) * Cos(v0), -Gamma * Cos(u0)); center = .5*(pt1 + pt2); distance = min(norm(pt1-camera.viewpt()),norm(pt2-camera.viewpt())); //distance = norm(center-camera.viewpt()); } double how_far() const { return distance; } void draw() const { plain(Black()); arrow(pt1, pt2, .3); } }; class by_distance { public: bool operator() (const mesh_quad& arg1, const mesh_quad& arg2) { return arg1.how_far() > arg2.how_far(); } bool operator() (const mesh_vf& arg1, const mesh_vf& arg2) { return arg1.how_far() > arg2.how_far(); } bool operator() (const mesh_quad& arg1, const mesh_vf& arg2) { return arg1.how_far() > arg2.how_far(); } bool operator() (const mesh_vf& arg1, const mesh_quad& arg2) { return arg1.how_far() > arg2.how_far(); } }; } // end of namespace int main() { picture(P(-2.5,-3.5),P(3.5,3), "12x10cm"); begin(); set_crop(); viewpoint(sph(10, 80 * M_PI / 180, 30 * M_PI / 180)); // background grids pen(Gray(.5)); grid(P(-2, -2, -2), P(2, 2, -2), 4,4); grid(P(-2, -2, -2), P(2, -2, 2), 4,4); // n.b. (z,x) divisions grid(P(-2, -2, -2), P(-2, 2, 2), 4,4); label(P(2, 0, -2), P(-15, -15), "$y$", bl); label(P(2, -2, -2), P(-2, -2), "$-2$", bl); label(P(2, -1, -2), P(-2, -2), "$-1$", bl); label(P(2, 0, -2), P(-2, -2), "$0$", bl); label(P(2, 1, -2), P(-2, -2), "$1$", bl); label(P(-2, 2, 0), P(15, -15), "$z$", br); label(P(-2, 2, -1), P(2, 0), "$-1$", br); label(P(-2, 2, 0), P(2, 0), "$0$", br); label(P(-2, 2, 1), P(2, 0), "$1$", br); label(P(-2, 2, 2), P(2, 0), "$2$", br); label(P(0, 2, -2), P(0, -20), "$x$", b); label(P(-1, 2, -2), P(0, -3), "$-1$", b); label(P(-2, 2, -2), P(0, -3), "$-2$", b); label(P(0, 2, -2), P(0, -3), "$0$", b); label(P(1, 2, -2), P(0, -3), "$1$", b); label(P(2, 2, -2), P(0, -3), "$2$", b); // build and draw a torus with vector field std::vector<mesh_quad> mesh; for (int i=0; i<N1; ++i) for (int j=0; j<N2; ++j) mesh.push_back(mesh_quad(F, i*du, j*dv)); sort(mesh.begin(), mesh.end(), by_distance()); std::vector<mesh_vf> vf; for (int i=0; i<N1; ++i) for (int j=0; j<N2; ++j) vf.push_back(mesh_vf(F, i*du, j*dv)); // vf.push_back(mesh_vf(F, (i+.5)*du, (j+.5)*dv)); sort(vf.begin(), vf.end(), by_distance()); int j = 0; for (unsigned int i=0; i<mesh.size(); ++i) { mesh.at(i).draw(); if (j < vf.size()) { for ( ; (vf.at(j).how_far() > mesh.at(i).how_far()) && (j < vf.size()); j++) vf.at(j).draw(); } } for ( ; j < vf.size(); j++) vf.at(j).draw(); //label_color(Red()); //spot(P(0,2,0)); tikz_format(); end(); } Here is a screenshot of the result:
- TikZ Drawing a changing vector field in a gridby Nils on June 6, 2011 at 12:21 pm
So far I succeeded in drawing a simple grid along with it's centres using grid and nodes. \draw[step=1] (0, 0) grid (4, 3); \coordinate (a) at (0.4, 0.3); \coordinate (b) at (3.8, 0.8); \draw[fill=white,thick,->] (a) -- (b); \foreach \x in {0.5, 1.5, 2.5, 3.5} { \foreach \y in {0.5, 1.5, 2.5} { \node at (\x, \y)[circle, fill=black, scale=0.25] {}; } } However the nodes representing the centroids of the cells, I would also like to add a vector field. The vectors in a column should point in the same direction, but along the x axis they should point more in the upward direction as one goes to the right side (like Pi/8, Pi/4, 3*Pi/4, etc). It's clear to me how this would be programmed in a "normal" programming language, but I don't see how this fits into TikZ's foreach loop.. Also I'm wondering weather it's possible to have a curvilinear grid instead of a simple rectangular.