• My goal is to approximate an arc length reparameterization
    by Jasper on August 16, 2026 at 9:51 pm

    My goal is to approximate an arc length reparameterization. The thick curve and the red curve should nearly coincide is the expected result. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{mathtools} \usepackage{unicode-math} \tikzset{ declare function={ alpha(\t)=1/\t; dalpha(\t)=(alpha(\t+0.02)-alpha(\t-0.02))/0.04; length(\x,\y)=sqrt((\x)^2+(\y)^2); ldalpha(\t)=length(1,dalpha(\t)); } } \pgfmathdeclarefunction{riemannsumldalpha}{3}{% \pgfmathsetmacro{\count}{0}% \pgfmathsetmacro{\dx}{(#2-#1)/#3}% \pgfplotsinvokeforeach{1,...,#3} {% \pgfmathsetmacro{\count}{\count+ldalpha(#1+##1*\dx)*\dx}% }% \let\pgfmathresult\count% } \pgfmathdeclarefunction{inverseriemannsumldalpha}{4}{% \pgfmathsetmacro{\lo}{#2}% \pgfmathsetmacro{\hi}{#3}% \pgfplotsinvokeforeach{1,...,#4}{% \pgfmathsetmacro{\mid}{(\lo+\hi)/2}% \pgfmathsetmacro{\value}{riemannsumldalpha(0.25,\mid,#4)}% \pgfmathsetmacro{\test}{\value < #1}% \ifnum\test=1 \pgfmathsetmacro{\lo}{\mid}% \else \pgfmathsetmacro{\hi}{\mid}% \fi }% \pgfmathsetmacro{\pgfmathresult}{(\lo+\hi)/2}% } \tikzset{ declare function={ alphainverseriemannsumldalpha(\t,\s,\e,\sam)=alpha( inverseriemannsumldalpha(\t,\s,\e,\sam) ); } } \begin{document} Let \(\alpha(t)=1/t\). My goal is to approximate an arc length reparameterization. I believe that plotting the following composition will achieve this; \[\alpha\Biggl(\biggl(\int_{t_0}^t\lvert\alpha'(t)\rvert\,dt\biggr)^{-1}\Biggr).\] \begin{center} \begin{tikzpicture}[samples=5] % producing the expected result \draw[red] plot[domain=0.25:4] (\x,{alpha(\x)}); \draw[green] plot[domain=0.25:4] (\x,{dalpha(\x)}); \draw[blue] plot[domain=0.25:4] (\x,{ldalpha(\x)}); \draw[purple] plot[domain=0.25:4] (\x,{riemannsumldalpha(0.25,\x,7)}); \draw[yellow] plot[domain=0.25:4] (\x,{inverseriemannsumldalpha(\x,0.25,4,7)}); % not producing the expected result \draw[thick] plot[domain=0.25:4] (\x,{alphainverseriemannsumldalpha(\x,0.25,4,7)}); \end{tikzpicture} \end{center} \end{document}

  • Triangle Nesting ( Similar to Sierpinski Triangles ) [duplicate]
    by Discrete on August 15, 2026 at 7:09 pm

    Im curious to know if there is a more efficient way to have triangles repeat themselves in one another without needing to run the \draw command for each line of the triangle; similar to Sierpinski's triangles is essentially what it is but in a different way for nesting. So far i've been doing the \draw command as such \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} [scale = 3] \draw[thick] (0,0) -- (2,0) -- (1,1.73205) -- cycle; \draw[thick] (0,0) -- (1,0.8) (2,0) -- (1,0.8) -- (1,1.73205) -- (1,0.8); \draw[thick] (1,0.8) -- (1.566667,0.769); \end{tikzpicture} \end{document} Ive provided an example above of what it should look like however I need to define what the colors mean and some rules it has. Meaning of Colors: Black = 1st Generation triangles, Blue = 2nd Generation triangles, and Red = 3rd Generation triangles as well each generation has a specific intersection where all the points meet ( for example black has a intersection in the middle where all points meet ) I should also say that each generation has its own "sub section" where the rule above applies to each sub section and these sub sections are divided by the lines of the previous generation. ( for example a 3rd generation sub section can have a different intersection than another 3rd generation sub section this is so each has one intersection which will for the sake of simplicity be set in the center for all generations) if you have any questions on this to better help me feel free to ask and I apologize if some of it seems confusing it is a rather "niche" section of discrete geometry relating to triangles and other two dimensional shapes ( side note i'd like this concept to be done with other two dimensional shapes as well so if theres a way to set the starting shape to say a circle or another shape that would be amazing; and it would follow the same rules I have revealed here).

  • How to draw highly accurate, continuous pH titration curves with the tangent method in TikZ/pgfplots?
    by Natsu on August 15, 2026 at 5:28 pm

    When attempting to plot pH-metric titration curves for weak/polyprotic acids and bases using piecewise Henderson-Hasselbalch approximations, sharp breaks and discontinuous artifacts often appear near equivalence points. Is there a robust, automated way in TikZ and pgfplots to plot continuous curves using exact charge and mass balance equations, while also supporting geometric constructions such as the tangent method (méthode des tangentes)?

  • How to reproduce the correct intersection curve of two 3D surfaces using PGFPlots?
    by Samia Rani on August 10, 2026 at 10:50 am

    I am trying to reproduce a 3D figure from a mathematics book in LaTeX using TikZ/PGFPlots. The figure shows two surfaces and their intersection. The two surfaces are given by x^2 + xy - y - 3z = 0 and 2x^2 + 3xy - 2y - 3z = 0. I plotted both surfaces directly from their equations and also added their intersection curve. However, the shape and especially the intersection curve in my output look quite different from the figure in the book, even though I am using the same equations. I am not sure whether the difference is caused by the viewing angle, the plotting ranges, the parametrization of the intersection curve, or something else. Here is my current code: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ view={120}{25}, axis lines=none, xmin=-2.5, xmax=2.5, ymin=-2.5, ymax=2.5, zmin=-5, zmax=5, width=11cm, height=8cm, ticks=none, ] %================================================ % GREEN SURFACE % 2x^2 + 3xy - 2y - 3z = 0 %================================================ \addplot3[ surf, shader=interp, colormap={greenmap}{ color(0cm)=(green!15); color(1cm)=(green!35) }, colormap name=greenmap, domain=-2:2, y domain=-2:2, samples=35, samples y=35, opacity=0.65, ] { (2*x^2 + 3*x*y - 2*y)/3 }; %================================================ % BLUE SURFACE % x^2 + xy - y - 3z = 0 %================================================ \addplot3[ surf, shader=interp, colormap={bluemap}{ color(0cm)=(blue!15); color(1cm)=(blue!35) }, colormap name=bluemap, domain=-2.2:2.2, y domain=-2.2:2.2, samples=30, samples y=30, opacity=0.55, ] { (x^2 + x*y - y)/3 }; %================================================ % INTERSECTION CURVE % gamma(t) = % ( t, -t^2/(2t-1), t^3/(3(2t-1)) ) %================================================ \addplot3[ very thick, red, samples=100, domain=-2.2:0.35, variable=\t, ] ( {\t}, {-\t^2/(2*\t-1)}, {\t^3/(3*(2*\t-1))} ); \addplot3[ very thick, red, samples=50, domain=0.65:2.2, variable=\t, ] ( {\t}, {-\t^2/(2*\t-1)}, {\t^3/(3*(2*\t-1))} ); \end{axis} \end{tikzpicture} \end{document} The book's figure has a noticeably different orientation and shape for the two surfaces and their intersection. The book's figure looks like this: My current output looks like this: Could someone please explain what is causing this difference and how I can modify my PGFPlots code to obtain a figure that looks like the one in the book? In particular, I would like to know whether I should change the view angles, the plotting domains, or the parametrization of the intersection curve.

  • How can I draw the plane and intersection curve on a one-sheet hyperboloid in TikZ?
    by Samia Rani on August 9, 2026 at 5:23 pm

    I am trying to recreate the following mathematical figure in LaTeX/TikZ. The figure shows the one-sheet hyperboloid x^2 + y^2 - z^2 = 1 together with the plane 2x + z = 1. Their intersection is the red curve shown on the hyperboloid. After quite a lot of effort, I have managed to draw the one-sheet hyperboloid reasonably well in TikZ. However, I am having difficulty with the two remaining parts: How can I draw the transparent red plane 2x + z = 1 behind/in front of the hyperboloid, as shown in the reference image? How can I draw the red intersection curve between the plane and the hyperboloid so that it lies correctly on the surface? I would like the final figure to look as close as possible to the reference image, including the perspective, transparency of the plane, and the red intersection curve. Here is the code I currently have for the hyperboloid: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture}[>=stealth] \begin{axis}[ view={120}{22}, axis lines=none, xmin=-3.3, xmax=3.3, ymin=-3.3, ymax=3.3, zmin=-2.0, zmax=2.0, xtick=\empty, ytick=\empty, ztick=\empty, clip=false, ] %------------------------------------------------ % Red point at the origin %------------------------------------------------ \addplot3[ only marks, mark=*, mark size=2.5pt, draw=red, fill=red, ] coordinates {(0,0,0)}; %------------------------------------------------ % Smooth one-sheet hyperboloid %------------------------------------------------ \addplot3[ surf, shader=interp, draw=blue!55!black, opacity=0.65, samples=45, samples y=80, domain=-2.2:2.2, y domain=0:360, z buffer=sort, ] ( {sqrt(1+x^2)*cos(y)}, {sqrt(1+x^2)*sin(y)}, {x} ); %------------------------------------------------ % POSITIVE x-axis %------------------------------------------------ \draw[ ->, black, thick ] (axis cs:0,0,0) -- (axis cs:5.0,0,0) node[right] {$x$}; %------------------------------------------------ % NEGATIVE x-axis -- dashed %------------------------------------------------ \draw[ dashed, black, thick ] (axis cs:0,0,0) -- (axis cs:-2.0,0,0); %------------------------------------------------ % POSITIVE y-axis %------------------------------------------------ \draw[ ->, black, thick ] (axis cs:0,0,0) -- (axis cs:0,4.0,0) node[above left] {$y$}; %------------------------------------------------ % NEGATIVE y-axis -- dashed %------------------------------------------------ \draw[ dashed, black, thick ] (axis cs:0,0,0) -- (axis cs:0,-1.0,0); %------------------------------------------------ % POSITIVE z-axis %------------------------------------------------ \draw[ ->, black, thick ] (axis cs:0,0,0) -- (axis cs:0,0,3.0) node[above] {$z$}; %------------------------------------------------ % NEGATIVE z-axis -- dashed %------------------------------------------------ \draw[ dashed, black, thick ] (axis cs:0,0,0) -- (axis cs:0,0,-2.0); %------------------------------------------------ % Origin %------------------------------------------------ \node[ below right, inner sep=1pt ] at (axis cs:0,0,0) {$0$}; %------------------------------------------------ % Equation %------------------------------------------------ \node[ blue!75!black, font=\large ] at (axis cs:2.0,-0.5,1.1) {$x^2+y^2-z^2=1$}; \end{axis} \end{tikzpicture} \end{document} I would be very grateful for any suggestions on how to add the plane and, especially, the intersection curve correctly. Thank you!

  • align hitbox of rotated reference cited in TikZ image
    by ali bab613 on August 8, 2026 at 2:52 pm

    I have a document which calls a .tex file that contains a standalone TikZ image. Within that image, I cite several references in a rotated node. I have the MWE here: main.tex: \documentclass{article} \usepackage{tikz} \usepackage{standalone} \usepackage{hyperref} \begin{document} \input{Chapter1} \bibliographystyle{IEEEtran} \bibliography{references} \end{document} and Chapter 1.tex: \documentclass{standalone} \usepackage{hyperref} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[color=black,rotate=17] at (3.25,-2.35) {\tiny\cite{Test1,Test2,Test3,Test4,Test5}}; \end{tikzpicture} \end{document} Most answers online deal with hyperref to an image that's entirely rotated, in my case this is one node amongst many, and the picture is not rotated. I did not suppress the hitboxes in hyperref (by using \usepackage[breaklinks]{hyperref}) for demonstration purposes, but the problem (obviously) persists for both cases. Here's a screenshot of the resulting image, and its hitboxes: The issue is not only that the box does not rotate (which isn't a massive problem), it's more that it does not align vertically, especially the further along the node you go. Changing the citation to {\tiny\cite{Test1,Test2,Test3,Test4}\cite{Test5}} also does not adjust the box vertically: This may be a long shot, but is there a way to better align the hitbox with the node?

  • TikZ to draw an arrow along the side of a table
    by Maronite Monks on August 7, 2026 at 2:06 pm

    I have a table to which I'd like to add a curved arrow (with an arrowhead at one end) running outside the table. The line will originate at the upper left portion of a table and end with the arrow pointing at the lower left portion. Another similar arrow will be outside the lower right side of the table and end pointing at the upper right side. I'd like some text to follow the curve of the arrows on each side of the table. The text for the left arrow will say: "Gives rise to the irascible". The text on the right will say: "Resolves in the concupiscible". Here's a MWE I've compiled with LuaLaTeX. \documentclass[12pt]{memoir} \addtolength\tabcolsep{.5in} \renewcommand\arraystretch{1.5} \begin{document} \begin{center} \begin{tabular}{c|c} \hline\hline {\scshape Good}& {\scshape Evil}\\\hline\hline\\[-9pt] love & hate \\\hline desire & avoid \\\hline joy & sad \\\hline\hline\\[-9pt] hope & bold \\\hline despair & fear \\\hline\hline\\[-9pt] & anger \end{tabular} \end{center} \end{document}

  • How to easily draw and parameterize various pH titration curves (including diprotic/dibasic) for a beginner?
    by user446526 on August 6, 2026 at 8:23 am

    I am a complete beginner when it comes to drawing complex functional plots in LaTeX. I am trying to create several types of pH titration curves for a document, but I am struggling to write the code from scratch. I found a very helpful French website that seems to have the exact mathematical logic and LaTeX code for what I need: https://www.astrolabe-science.fr/courbes-titrages-acido-basiques-latex/ However, as a beginner, I find it quite difficult to extract just the essential parts to create a simple, easily editable template. I need to recreate the following types of curves (I have attached images of what I am aiming for): The 4 basic monoprotic titrations: Strong Acid, Strong Base, Weak Acid, and Weak Base. Diprotic acid titration: A curve with two equivalence points (increasing pH). Dibase titration: A curve with two equivalence points (decreasing pH). My request: Could someone help provide a simplified, beginner-friendly pgfplots (or TikZ) template based on the math from that website? Ideally, I am looking for a code structure where the main parameters (like initial concentrations, volumes, and pK_a values) are defined at the top so I can easily change them. It would be incredibly helpful if you could include brief comments/instructions inside the code explaining how to switch between the different types of curves (e.g., "change this sign for a base", "uncomment this for a diprotic acid"). Thank you so much for your time and help! I have attached images of what I am aiming for.

  • Plot a domain in 3D with TikZ for a triple integral
    by Sebastiano on April 20, 2026 at 9:59 pm

    I have to solve this triple integral ∭ x y|z|³/(1+ (x²+y²)⁴)  dx  dy dz, with a domain T={(x, y, z) ∈ ℝ³: x ≤ 0, y ≥ 0, z² ≤ x²+y² ≤ 1}. Plotting with DESMOS 3D I see this: Actually I am not able to visualise this domain in my mind. It should be a cylinder enclosed by a double-sloped cone, but I can’t quite get the x ≤ 0, y ≥ 0 parameters right. I’ve created something but I would like my drawing (or a new one) to be intuitive with TikZ3D so that I can correctly draw this integral. My MWE: \documentclass[12pt]{article} \usepackage{tikz} \usepackage{tikz-3dplot} \tdplotsetmaincoords{60}{130} \begin{document} \begin{tikzpicture}[tdplot_main_coords, scale=3] % assi \draw[->] (0,0,0) -- (1.3,0,0) node[right]{$x$}; \draw[->] (0,0,0) -- (0,1.3,0) node[left]{$y$}; \draw[->] (0,0,0) -- (0,0,1.3) node[above]{$z$}; \foreach \t in {0,1,...,359}{ \pgfmathsetmacro{\ct}{cos(\t)} \pgfmathsetmacro{\st}{sin(\t)} \draw[blue!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{\x}); \draw[red!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{-\x}); } \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},1); \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},-1); \end{tikzpicture} \end{document}

  • How to avoid duplicate chapter title and absolutely position chapter title with TikZ
    by Chen Mortenfeld on June 12, 2025 at 7:50 pm

    I'm customizing chapter titles in my book using the titlesec and tikz packages. For special chapters like the "Preface", I want to: Show a custom TikZ-styled title box that is positioned exactly \TitleBoxOffset below the top of the page (absolute positioning, not relative). Avoid having the chapter title (e.g., "Preface") appear twice on the page — once inside my TikZ box and once from LaTeX's default chapter title mechanism. So basically "Preface" appears twice, and the location is set manually. Here's my code in the .sty file: \usepackage[explicit]{titlesec} \usepackage{tikz} \usepackage{xcolor} \usepackage{etoolbox} % for \IfStrEq \newcommand{\CurrentChapterTitle}{} \newlength{\ChapterTopSkip} \newcommand{\ChapterHook}[1]{% \renewcommand{\CurrentChapterTitle}{#1}% \IfStrEq{#1}{Preface}{% \titleformat{\chapter} [block] {\centering} {} % no label {0pt} {% \begin{tikzpicture} \node[ draw=lightblue, line width=1pt, rounded corners=10pt, minimum width=0.8\linewidth, minimum height=2cm, align=center, fill=white, fill opacity=1, text opacity=1 ] {\scalebox{1.4}{\textcolor{lightblue}{\Huge{#1}}}}; \end{tikzpicture} } % \titlespacing*{\chapter}{0pt}{-\topskip}{20pt} \titlespacing*{\chapter}{0pt}{-95pt}{20pt} } {% \titleformat{\chapter}[block] {\normalfont\scshape\Huge\centering} {\fontsize{140pt}{140pt}\selectfont\thechapter\\} {0pt} {\normalfont\scshape\Huge\centering #1} }% } % % Patch \chapter to call ChapterHook \let\oldchapter\chapter \renewcommand{\chapter}[1]{% \ChapterHook{#1}% \oldchapter{#1}% } % Suppress LaTeX’s default \@makechapterhead \makeatletter \renewcommand{\@makechapterhead}[1]{} \makeatother Update: I updated the code block to include the packages. Thanks to the comments, I managed to make the word "Preface" appear only once, by using: \usepackage[explicit]{titlesec} see the update code. Now my only issue is the position of the title that I define manually — I want it to be at position 0 relative to the page boundaries, and then I’ll subtract a fixed predefined offset from it. Thank you!

  • Partially dashed orthogonal projection of a straight line onto a plane
    by Mr.Price on February 11, 2025 at 7:23 pm

    I have the following 3D plot in Tikz which represents plane, segment that intersects the plane and the orthogonal projection of that segment onto that plane: \documentclass[tikz, margin=2mm]{standalone} \usetikzlibrary{angles, quotes} \usepackage{amssymb} \usetikzlibrary {arrows.meta, shapes.geometric, trees, shapes, backgrounds,intersections, patterns,decorations.markings} \usepackage{pgfplots} \usepgfplotslibrary{units} \usetikzlibrary{positioning} \usepackage{amsmath, amssymb} \usepackage{siunitx} \usepackage{tikz-3dplot} \usepackage[dvipsnames]{xcolor} \usepackage{polski} \usepackage{tkz-euclide} \begin{document} \tikzset{background grid/.append style={step=.5cm, ultra thin, dashed, gray!50}} \begin{tikzpicture}[show background grid, >=Stealth] \begin{scope}[canvas is xz plane at y=0] \path[] (0,0) coordinate (A) (4,0) coordinate (B) (4,4) coordinate (C) (0,4) coordinate (D) (2,2) coordinate (Q) (5,0) coordinate (P') ; \end{scope} \begin{scope}[canvas is xz plane at y=3] \path[] (5,2) coordinate (P); \end{scope} \tkzDrawPolygon[thick, fill=Dandelion!50, fill opacity=0.8](A,B,C,D) \tkzDefMidPoint(P,Q)\tkzGetPoint{MPQ} \tkzDrawSegment[Green, thick](P,Q) \tkzLabelSegment[Green, left, pos=0.85](P,Q){$k$} \tkzDrawPoints[black, size=3pt](P,Q) \tkzLabelPoint[above left=0 and -1mm](P){$P$} \tkzDrawSegment[Red, thick, add=1.3 and 0.5](Q,P') \end{tikzpicture} \end{document} The output is the following: What I want to do is to extend that segment to make it look like a line that cuts the plane in such a way that the part below plane is solid but the part between cutting point and bottom part of the plane is dashed. How can I do that? And also, is there a way to calculate the coordinates of orthogonal projection of point P on that plane? I just set its y coordinate to 0 but it does not seems to be correct, expecially when I want to draw an straight angle.

  • Drawing the Steinmetz solid with TikZ
    by Knudsen on September 13, 2024 at 10:48 pm

    I want to draw the Steinmetz solid, the volume enclosed by two cilinder of same radius intersecting orthogonaly. I have so far been able to draw the circles in 3D and the lines till their intersecting point. \documentclass{standalone} \usepackage{tikz,tikz-3dplot} \begin{document} \def\rotx{60} \def\rotz{110} \def\eps{0.5} \tdplotsetmaincoords{\rotx}{\rotz} \begin{tikzpicture}[tdplot_main_coords][scale=0.75] \tikzstyle{every node}=[font=\small] % The axis: \draw[dashed,-latex] (-5,0,0) -- (6,0,0) node[anchor=north east]{$x$}; \draw[dashed,-latex] (0,-5,0) -- (0,6,0) node[anchor=north west]{$y$}; \draw[dashed,-latex] (0,0,-5) -- (0,0,6) node[anchor=south]{$z$}; \draw [very thick,blue](0,-3-\eps,0) [y={(0,0,1)}] circle (3); \draw [very thick,blue](0,3+\eps,0) [y={(0,0,1)}] circle (3); \draw [very thick,red](-3-\eps,0,0) [x={(0,0,1)}] circle (3); \draw [very thick,red](3+\eps,0,0) [x={(0,0,1)}] circle (3); \foreach \angle in {0,10,...,360} { %calculate the sine and cosine of the angle \tdplotsinandcos{\sintheta}{\costheta}{\angle}% % draw the lines \draw[thin, blue] (3*\costheta,-3-\eps, 3*\sintheta) -- (3*\costheta,{-3*abs(\costheta)},3*\sintheta) (3*\costheta,{3*abs(\costheta)},3*\sintheta) -- (3*\costheta,3+\eps, 3*\sintheta); \draw[thin, red] (-3-\eps, 3*\costheta,3*\sintheta) -- ({-3*abs(\costheta)},3*\costheta,3*\sintheta) ({3*abs(\costheta)},3*\costheta,3*\sintheta) -- (3+\eps, 3*\costheta,3*\sintheta); } \end{tikzpicture} \end{document} that renders as: but I am taking a black eye at drawing the intersecting elipses and hiding the lines that are not supposed to be visible. Are there automated ways to do this in TikZ and even to do a better picture of the solid, possibly using the shaded surface? Added Sep 14, 2024: After realizing that it would be harder to get a good looking picture from TikZ and a prompts from @Jasper and from @PauloNey, I went to dig a bit deeper on Asymptote. It became imediate clear that the syntax for 3D was easier and the results a lot better. With the code \documentclass{standalone} \usepackage[inline]{asymptote} \begin{document} \thispagestyle{empty} \begin{asy} import graph3; import solids; pen myBlue = cmyk(1.00, 0.15, 0, 0); pen myRed = cmyk(0, 1.00, 1.00, 0); size(0,150); currentprojection=orthographic(1,1/1.7,1/1.6); // usage revolution r = cylinder(start,radius,length,ax); revolution r=cylinder(O,1,2.8,X); draw(surface(r),myBlue,render(merge=true)); revolution r=cylinder((1.4,-1.4,0),1,2.8,Y); draw(surface(r),myRed,render(merge=true)); \end{asy} \end{document} one can get: but it is clear that ligthing is happening in one cylinder as if the other were not there, that is, on each independent of the other.

  • Can I simulate colour-blindness (in Beamer / TikZ)
    by Chris H on July 22, 2024 at 3:31 pm

    I'm putting together a talk on figures for publications, and one point I want to make is about them being accessible to colour-blind readers/viewers. So far I've been using ColorOracle to simulate what a colour-blind person might see (it's also handy for simulating greyscale). However this has a few downsides: It isn't an option using someone else's machine, like one of our seminar room setups, it doesn't play nicely with multiple monitors, and as soon as you click on another window, the display reverts to normal. This is probably wishful thinking, but is there a simple way to switch the contents of my slides to a simulated view? Just the LaTeX/TikZ content would be good, though of course imported logos and graphics would be better. Otherwise I would look for an external tool that can generate PDFs that I can then include, but that's not as flexible on the day. Some very useful background is in the preprint Easy colorblind-safe typesetting: General guidelines and a helpful LATEX package, Simon Pfahler TUG2024. My goals are similar.

  • Sphere with a randomly marked region and an equatorial circle
    by hteica on June 17, 2024 at 2:42 pm

    I'm working with spheres in 3D and would like to draw a sphere with an open region $U$ with color green and enclosed closed region $E$ filled with color red such that $E \subset U$. And a vector $x$ on the sphere with the dotted equatorial circle, however this circle should disappear in the region $U$. There is a similar post about this: Random closed line on a 3d sphere. I'd be gladly for any codes/tips/resources where I can learn to do this. Thank you

  • How to build cylinders similar to this, but in reverse?
    by TCR on April 8, 2024 at 8:06 pm

    How to build cylinder in tikz like shown in this example The example above builds a set of ever-larger cylinders on top of each other with texts on the side, starting at the bottom. The example output and code is replicated here. The source is the link above. \documentclass[border=3.14pt]{standalone} \usepackage{pgfplots} \definecolor{myellow}{RGB}{228,212,0} \definecolor{mgreen}{RGB}{5,104,57} \newcommand\funnel[3]{% \pgfmathsetmacro\mwid{(2+\xi*.7)} \pgfmathsetmacro\marc{\mwid-.4} \begin{scope}[% shift={(0,#1)}, line width=.05pt, %x=5mm, %scale=1.\xi, yshift=\xi*12 ] \draw[black,bottom color=#2, top color=#2] (-\mwid,0) -- (-\mwid+.4,-1) arc (190:350:\marc cm and 5mm) -- (\mwid,0); \draw[black,fill=#3] (0,0) ellipse (\mwid cm and 5mm); \path (-\mwid,0) -- (-\mwid+.4,-1) coordinate[midway] (a\xi); \end{scope} } \begin{document} \begin{tikzpicture}[ latent/.style={% ,circle ,draw ,thick ,minimum size=10mm } ] \foreach \text [% count=\xi starting from 0, evaluate=\xi as \shadecolor using int(25*\xi), evaluate=\xi as \coord using int(\xi-12) ] in {% Discuss and conclude\\overall findings, Combine the data\\\tiny\itshape (synthesis or meta-analysis), Assess the quality\\of the studies, Extract data from the studies }{% \funnel{\coord}{mgreen!\shadecolor !myellow}{mgreen!\shadecolor !myellow} \node[align=right, anchor=east, inner sep=10pt, font=\scriptsize, text width=2cm] at (a\xi) {\text}; } \end{tikzpicture} \end{document} I am looking for two things: A set of an arbitrary number of ever-larger cylinders on top of each other with texts on the side, starting from the top. Following the ever-larger cylinders, a set of an arbitrary number of ever-smaller cylinders on top of each other with texts on the side, starting from the top. (Effectively the same as the example, but rather than starting from the bottom and go up, it would start from the top and go down.) Ideally the size of the last (and the widest) cylinder from 1 would transition smoothly to the top-most cylinder from 2. In other words, I would like to have to have a set of cylinders first expanding as we move down and then narrowing. Thus far I have been tinkering with the funnel function by trying various combinations of positive and negative signs for \xi, \mwid, etc. None of the combinations have worked. Embarrassingly while the example code produces a wonder set of cylinders almost what I wanted, the PGF/TikZ code in it is much too advanced for my understanding. **Edits: 1. adding the final sentence as it was cut off; 2. steps I have attempted at creating what I wanted.

  • How can I remove the Labels of the blue dots on the left plot and change the position of label nr16 in the right plot?
    by dan1365 on March 30, 2023 at 9:46 am

    \documentclass[11pt]{report} \usepackage{pgfplots, pgfplotstable} \pgfplotsset{width=10cm,compat=1.18} \usepackage{graphicx} \usepackage{caption} \usepackage{subcaption} \begin{document} \begin{figure} \centering \begin{subfigure}[tb]{0.48\linewidth} \begin{tikzpicture} \begin{axis}[height=7cm, width=\linewidth, xlabel={}, ylabel={}, ytick={0,500,...,1700}, xtick={0,500,...,1700}, ymin=-170, ymax=1700, xmin=-170, xmax=1700, ymajorgrids, xmajorgrids] \addplot[ scatter/classes={0={blue}, 1={red}}, scatter, mark=*, only marks, scatter src=explicit symbolic, nodes near coords*={\Label}, visualization depends on={value \thisrow{label} \as \Label} %<- added value ] table [meta=class] { x y class label 0.3788 8.1653 0 - 6.3716 4.0196 0 - 0.4225 0.1447 0 - 14.8118 6.6124 0 - 2.7433 2.544 0 - 152.0046 30.6336 1 5 1375 428.5714 1 6 20.51 5.1280 0 - 38.8548 1492.8425 1 8 0.1409 0.000196 0 - }; \end{axis} \end{tikzpicture} \caption{} \label{} \end{subfigure}\hfill \begin{subfigure}[tb]{0.48\linewidth} \begin{tikzpicture} \begin{axis}[height=7cm, width=\linewidth, xlabel={}, ylabel={}, ytick={0,2,...,10}, xtick={0,5,...,20}, ymin=-1.133, ymax=11.333, xmin=-2.266, xmax=22.666, ymajorgrids, xmajorgrids] \addplot[ scatter/classes={0={blue}, 1={red}}, scatter, mark=*, only marks, scatter src=explicit symbolic, nodes near coords*={\Label}, visualization depends on={value \thisrow{label} \as \Label} %<- added value ] table [meta=class] { x y class label 0.3788 8.1653 0 9 6.3716 4.0196 0 10 0.4225 0.1447 0 12 14.8118 6.6124 0 13 2.7433 2.544 0 14 20.51 5.1280 0 15 0.1409 0.000196 0 16 }; \end{axis} \end{tikzpicture} \caption{} \label{} \end{subfigure}\hfill \caption{} \end{figure} \end{document} > Blockquote

  • tabularray and babel french
    by jrivet on April 7, 2022 at 1:34 pm

    I need to use \usetikzlibrary{babel} but it causes an error in the folowing example. \documentclass[french]{article} \usepackage{babel} \usepackage{tabularray} \usepackage{pgfplots} \usepackage{circuitikz} %to draw an electrical circuit %\usetikzlibrary{babel} %I need this library because I use french babel and circuitikz \begin{document} \begin{center} \begin{tblr}{colspec={Q[c,m]Q[c,m]},vlines,hlines} $y=2x$ & \begin{tikzpicture}[baseline=(current bounding box.center)] \begin{axis}[ xlabel = {$x$}, ylabel = {$y$}, ] \addplot[domain=0:10]{2*x}; \end{axis} \end{tikzpicture} \end{tblr} \end{center} \end{document}

  • Tikz : Customize dotted line on a portion of the segment
    by RedWest on May 7, 2021 at 2:21 am

    I am looking to change the pattern of a segment in the middle of it or after a predefined distance in cm or pt for example. I have tried to look at the draw pattern but without finding any good solutions. Does anyone have any ideas? Here is the basic code : \documentclass[border=1cm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node at (0,0) [circle,draw]{$t_1$}; \node at (1.5,0) [circle,draw]{$t_2$}; \node at (3,0) [circle,draw]{$t_3$}; \node at (4.5,0) [circle,draw]{$t_4$}; \node at (6,0) [circle,draw]{$t_4$}; \draw [color=red!100,line width=1pt](0,-0.4) to [bend right=45] (1.5,-0.4); \draw [color=red!100,line width=1pt](1.5,-0.4) to [bend right=45] (3,-0.4); \draw [color=red!100,line width=1pt](3,-0.4) to [bend right=45] (4.5,-0.4); \draw [color=red!100,line width=1pt](4.5,-0.4) to [bend right=45] (6,-0.4); \draw [color=blue!100,line width=1pt](0,-0.4) to [bend right=45] (3,-0.4); \draw [color=green!100,line width=1pt](0,-0.4) to [bend right=45] (3,-0.4); \draw [color=blue!100,line width=1pt](0,0.4) to [bend left=45] (6,0.4); \end{tikzpicture} \end{document}

  • plotting a 3D cone
    by Nilcouv on April 21, 2020 at 2:50 pm

    I'm trying to plot a cone in 3D, but I'm a little stuck. I plotted a densely dashed, then I'm trying to plot the border of the cone, divided in 3 part: The green part is static The blue part change depending on the height of the cone The red part is just a connection between a dot "h" and the blue part. I'm unable to plot the red left part of the cone, and the there is a black line when "height=0" %%%%%%%%%%%%%%%%%% INTRODUCTION %%%%%%%%%%%%%%%%%% \documentclass[border=10pt]{standalone} %%%%%%%%%%%%%%%%%% PACKAGE %%%%%%%%%%%%%%%%%% \usepackage{tikz, tkz-euclide}% permet de dessiner des figures, des graphiques \usepackage{adjustbox}% permet de déterminer une taille de fenêtre %% FONT \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tgadventor}% paquet de police de caractère TGadventor \usepackage{sansmath}% Copie-colle la police active dans % \sfdefault (/!\ N'EST PAS UNE POLICE DE CARACTÈRES) \usepackage{xcolor} %%%%%%%%%%%%%%%%%% INPUT %%%%%%%%%%%%%%%%%% %\input{preamble} %\input{parameters} %\input{types/f3d_fig} %%%%%%%%%%%%%%%%%% SETUP %%%%%%%%%%%%%%%%%% \tikzset{volum3D/.style={font={\sansmath\sffamily\large}, line width=0.4mm, line cap=round, line join=round, >=latex,}} %%%%%%%%%%%%%%%%%%%%%%%% CONE %%%%%%%%%%%%%%%%%%%%%%%% \makeatletter \tikzset{pics/cone/.style={code={% \tikzset{cone/.cd,#1}% \def\pv##1{\pgfkeysvalueof{/tikz/cone/##1}}% \pgfmathsetmacro{\myan}{atan2(\pgf@zx,\pgf@xx)}% \begin{scope}[local bounding box=sph]% %%% Compute the angle \pgfmathsetmacro\angle{acos(1/\pv{height})} \path[cone/corps] %%% Patrie supérieur (0, \pv{height}*\pv{scale}, 0) coordinate (h) node[above] {\angle} node[below] {\myan} %%% Patrie droite (h) -- plot[smooth,variable=\t,samples=19,domain={(sign(\myan)*90+\myan)-\angle}:\myan] ({\pv{ray}*\pv{scale}*cos(\t)}, 0, {\pv{ray}*\pv{scale}*sin(\t)}) %%% Patrie Inférieur -- plot[smooth,variable=\t,samples=19,domain=\myan:{-1*sign(\myan)*180+\myan}] ({\pv{ray}*\pv{scale}*cos(\t)}, 0, {\pv{ray}*\pv{scale}*sin(\t)}) %%% Patrie gauche %-- plot[smooth,variable=\t,samples=19,domain={180*\myan-\myan}:\myan] %({\pv{ray}*\pv{scale}*cos(\t)}, %0, %{\pv{ray}*\pv{scale}*sin(\t)}) -- cycle ; %%% CERCLE EN POINTILLÉ \draw[thick, densely dashed] %%% Arc Avant plot[smooth,variable=\t,samples=19,domain={-1*sign(\myan)*180+\myan}:\myan] ({\pv{ray}*\pv{scale}*cos(\t)}, 0, {\pv{ray}*\pv{scale}*sin(\t)}) %%% Arc Arrière plot[smooth,variable=\t,samples=19,domain={sign(\myan)*180+\myan}:\myan] ({\pv{ray}*\pv{scale}*cos(\t)}, 0, {\pv{ray}*\pv{scale}*sin(\t)}) ; \end{scope} %% Dot (0,0) \draw (0,0,0) node[circle, fill=black, inner sep=1pt] {} coordinate (o) ; }}, cone/.cd, ray/.initial=5, height/.initial=3, scale/.initial=1, corps/.style={draw,fill=black!15}, } \makeatother %%%%%%%%%%%%%%%%%% DOCUMENT %%%%%%%%%%%%%%%%%% \begin{document} \begin{tikzpicture}[volum3D, x={(0:1cm)}, y={(90:1cm)}, z={(89:0.4cm), scale=0.5}] % calibration cross %\pic at (5,0,0) {calcross}; % Figures \foreach \h in {0.5,1,...,8}{ \begin{scope}[shift={(6.2*\h,0)}] \pic{cone={ray=3, height=\h, scale=0.5}}; \end{scope} } \end{tikzpicture} \end{document}

  • Remove Zero as Chapter Number in Header Using scrlayer-scrpage
    by Echo on April 9, 2020 at 7:16 pm

    I am currently working on a layout for a document (based on this post and this), using scrbook with scrlayer-scrpage. After a long struggle to get lines with rounded corners in the header and footer, everything works as expected -- except the numbering of the table of contents in the header. For some reason that I do not understand (I am sure because lack of basic knowledge) it gets a chapter number 0 and section number 0.0, instead of an empty field, which is the desired output for unnumbered chapters. When I compile my document with the slightly modified original code for the header no numbers are given for the table of contents. Based on this, my idea was to use \ifnumbered{chapter}{THEN}{ELSE}, either by redefining \chaptermarkformat and \sectionmarkformat (IDEA 1) or by changing the output for \lehead{} (and \rohead{} IDEA 2). What am I missing? Any help is much appreciated. Thank you in advance. Here is the code containing my approaches and the modified original code for the header and footer for camparison: \documentclass[12pt,paper=a4,DIV=calc,parskip=off,numbers=noenddot,chapterprefix=false]{scrbook} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage[ngerman]{babel} \usepackage[T1]{fontenc} \usepackage{calc} \usepackage[dvipsnames]{xcolor} \usepackage[inner=1.5cm,outer=3.0cm,top=1.5cm,bottom=2cm,headheight=8mm,headsep=1cm,footskip=1cm,includeheadfoot]{geometry} % ,showframe \setlength{\marginparwidth}{2.77cm} \setlength{\marginparsep}{.2cm} \usepackage[onehalfspacing]{setspace} % Chapter Title Layout ------------------------------------------------- % BASED ON: https://tex.stackexchange.com/questions/423091/chapter-heading-designs-in-koma-script \usepackage{tikz} \usetikzlibrary{positioning, backgrounds} \usepackage[outline]{contour} \contourlength{1.25pt} \usepackage{tikzpagenodes} \renewcommand\raggedchapter{\raggedright} \setkomafont{chapter}{\Huge} \setkomafont{chapterprefix}{\LARGE} \newkomafont{chapternumber}{\bfseries\fontsize{75pt}{75pt}\selectfont} \tikzset{ headings/base/.style = { outer sep = 0pt, inner sep = 0pt, %draw, rectangle % just for testing purposes }, headings/chapterbackground/.style = { headings/base, % if shades are to be used (gave ugly results for the shading): % shade, % left color = white, % right color = black, % without shades: color = black }, headings/chapapp/.style = { headings/base, text = black, font = \usekomafont{chapterprefix} }, headings/chapternumber/.style= { headings/base, text = black, font = \usekomafont{chapternumber} } } \makeatletter \renewcommand*\chapterlinesformat[3]{% \ifstr{#1}{chapter}{% \begin{tikzpicture}[baseline=(title.base)] \node[headings/base,anchor=center](title){% \parbox[t]{\dimexpr\textwidth\relax} {\parbox[t][\height]{\dimexpr\textwidth\relax}{\raggedchapter{#3}}\strut}% {\raggedchapter{\leavevmode\vphantom{\textbf{Ôp'}}#3}} //orig: {\raggedchapter #3} }; % chapter number \ifstr{#2}{} { % a phantom chapternumber is set to achieve the same vertical spacing for toc and other unnumbered chapters as for numbered chapters \node(chapternumber)[anchor=south west,headings/chapternumber] at([yshift=-14.5pt] title.north east){\leavevmode\vphantom{88}};% \fill[headings/base,anchor=north west,rounded corners=2.5 pt] ([xshift=4 pt]chapternumber.north west) rectangle ([yshift=-7 pt,xshift=.33\marginparwidth+4 pt]chapternumber.north west);% \fill[headings/base,color=black!85,anchor=north west,rounded corners=2.5 pt] ([yshift=-9 pt,xshift=5.5pt]chapternumber.north west) rectangle ([yshift=-16 pt,xshift=.33\marginparwidth+5.5pt]chapternumber.north west);% \fill[headings/base,color=black!70,anchor=north west,rounded corners=2.5 pt] ([yshift=-18 pt,xshift=9pt]chapternumber.north west) rectangle ([yshift=-25 pt,xshift=.33\marginparwidth+9pt]chapternumber.north west);% \fill[headings/base,color=black!50,anchor=north west,rounded corners=2.5 pt] ([yshift=-27 pt,xshift=16.5pt]chapternumber.north west) rectangle ([yshift=-34 pt,xshift=.33\marginparwidth+16.5pt]chapternumber.north west);% \fill[headings/base,color=black!20,anchor=north west,rounded corners=2.5 pt] ([yshift=-36 pt,xshift=30pt]chapternumber.north west) rectangle ([yshift=-43 pt,xshift=.33\marginparwidth+30pt]chapternumber.north west);% \fill[headings/base,color=black!10,anchor=north west,rounded corners=2.5 pt] ([yshift=-45 pt,xshift=52pt]chapternumber.north west) rectangle ([yshift=-52 pt,xshift=.33\marginparwidth+52pt]chapternumber.north west);% } { % number definition for numbered chapters \node(chapternumber)[anchor=south west,headings/chapternumber] at([yshift=-14.5pt] title.north east){#2};% } % decorative element(s) \ifstr{#2}{}{}{ \fill[headings/chapterbackground,anchor=east,rounded corners=1 pt] ([yshift=11.5 pt]title.north east) rectangle ([yshift=13.5 pt,xshift=4.2 cm]title.north);% } % chapter prefix \node(chapapp)[headings/chapapp,anchor=north east] at (chapternumber.north west){\ifstr{#2}{}{\leavevmode\vphantom{\contour{white}\chapapp}}{\contour{white}\chapapp}\strut};% \end{tikzpicture} \par }{% \@hangfrom{#2}{#3}% other section levels using style=chapter }% } \makeatother % Header and Footer Layout -------------------------------- \usepackage[automark]{scrlayer-scrpage} \setkomafont{pageheadfoot}{\footnotesize} \setkomafont{pagehead}{\sffamily\normalsize} \setkomafont{pagenumber}{\sffamily\large} \clearpairofpagestyles \newlength{\vrulewidth} \setlength{\vrulewidth}{1.25 pt} \renewcommand\chaptermark[1]{% \markboth{\ifnumbered{chapter}{#1}{#1}}{\ifnumbered{chapter}{#1}{#1}}% } % IDEA 1: Supposed to remove chapternumber from header in table of contents -- does not % \renewcommand*{\chaptermarkformat}{% % \ifnumbered{chapter}{\chapappifchapterprefix{\ }\thechapter\autodot\enskip}{}% taken from scrguide % } \renewcommand\sectionmark[1]{% \markright{\ifnumbered{section}{#1}{#1}}% } % IDEA 1 (part 2): Supposed to remove sectionumber from header in table of contents -- does not % \renewcommand*{\sectionmarkformat}{% % \ifnumbered{section}{\thesection\autodot\enskip}{}% taken from scrguide % } \lehead{% % \ifnumbered{chapter}{% IDEA 2: Supposed to remove chapternumber from header in table of contents -- does not \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south east,rounded corners=0.5\vrulewidth] ([xshift=-\marginparsep+.5\vrulewidth] current page header area.south west) rectangle ([xshift=-\marginparsep-.5\vrulewidth,yshift=\baselineskip] current page header area.south west); \node[headings/base,anchor=south east] at ([xshift=-2\marginparsep] current page header area.south west){\ifnumbered{chapter}{\leavevmode\vphantom{\headmark\strut}\chaptermarkformat}{\leavevmode\vphantom{\headmark\strut}}}; \node[headings/base,anchor=south west] at (current page header area.south west){\headmark\strut}; \end{tikzpicture} % }% IDEA 2 (part 2) % {% % \begin{tikzpicture}[overlay,remember picture] % \fill[headings/base,color=black,anchor=south east,rounded corners=0.5\vrulewidth] % ([xshift=-\marginparsep+.5\vrulewidth] current page header area.south west) % rectangle % ([xshift=-\marginparsep-.5\vrulewidth,yshift=\baselineskip] current page header area.south west); %% \node[headings/base,anchor=south east] at ([xshift=-2\marginparsep] current page header area.south west){\ifnumbered{chapter}{\leavevmode\vphantom{\headmark\strut}\chaptermarkformat}{\leavevmode\vphantom{\headmark\strut}}}; % \node[headings/base,anchor=south west] at (current page header area.south west){\headmark\strut}; % \end{tikzpicture} % } } \rohead{% (IDEA 2 did not work for \lehead) \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south west,rounded corners=0.5\vrulewidth] ([xshift=\marginparsep-.5\vrulewidth] current page header area.south east) rectangle ([xshift=\marginparsep+.5\vrulewidth,yshift=\baselineskip] current page header area.south east); \node[headings/base,anchor=south west] at ([xshift=2\marginparsep] current page header area.south east){\ifnumbered{section}{\leavevmode\vphantom{\headmark\strut}\sectionmarkformat}{\leavevmode\vphantom{\headmark\strut}}}; \node[headings/base,anchor=south east] at (current page header area.south east){\headmark\strut}; \end{tikzpicture} } \lefoot*{% \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south east,rounded corners=0.5\vrulewidth] ([xshift=-\marginparsep+.5\vrulewidth] current page footer area.south west) rectangle ([xshift=-\marginparsep-.5\vrulewidth,yshift=-3\baselineskip] current page footer area.south west); \node[headings/base,anchor=south east] at ([xshift=-2\marginparsep,yshift=-3\baselineskip] current page footer area.south west){\pagemark\strut}; \end{tikzpicture}% } \rofoot*{% funktioniert ohne * nur auf nicht chapter-Seiten \begin{tikzpicture}[overlay,remember picture] \fill[headings/base,color=black,anchor=south west,rounded corners=0.5\vrulewidth] ([xshift=\marginparsep-.5\vrulewidth] current page footer area.south east) rectangle ([xshift=\marginparsep+.5\vrulewidth,yshift=-3\baselineskip] current page footer area.south east); \node[headings/base,anchor=south west] at ([xshift=2\marginparsep,yshift=-3\baselineskip] current page footer area.south east){\pagemark\strut}; \end{tikzpicture}% } % https://tex.stackexchange.com/questions/272824/pagenumbers-headers-with-vertical-lines-style %% here there are no numbers for the table of contents in the headings -- numbering in TOC as desired % \renewcommand*{\chaptermark}[1]{% % \markboth{% % \makebox[0pt][r]{% % \ifnumbered{chapter}{% % \chaptermarkformat% Kapitelnummer % %\enskip% Abstand -- wird zu groß, wenn nicht auskommentiert % \rule[-\dp\strutbox]{\vrulewidth}{\baselineskip}% Linie -- Offset,Breite,Höhe % \hspace*{\marginparsep}% Abstand % }{}% % }% % #1% Text % }{% % #1%Text % \makebox[0pt][l]{% % \hspace*{\marginparsep}% Abstand % \ifnumbered{chapter}{% % \rule[-\dp\strutbox]{\vrulewidth}{\baselineskip}% Linie -- Offset,Breite,Höhe % \enskip% Abstand % \chaptermarkformat% Kapitelnummer % }{}% % }% % }% % } % \renewcommand*{\sectionmark}[1]{% % \markright{% % #1%Text % \makebox[0pt][l]{% % \ifnumbered{section}{% % \hspace{\marginparsep}% Abstand % \rule[-\dp\strutbox]{\vrulewidth}{\baselineskip}% Linie -- Offset,Breite,Höhe % \enskip% Abstand % \sectionmarkformat% Abschnittsnummer % }{}% % }% % }% % } % \ohead{\headmark} % \rofoot*{% % \makebox[0pt][l]{% % \hspace{\marginparsep}% % \raisebox{0pt}[\ht\strutbox][\dp\strutbox]{% % \rule[-\dp\strutbox]{\vrulewidth}{2\baselineskip}% Linie -- Offset,Breite,Höhe % }% % \enskip % \pagemark % }% % } % \lefoot*{% % \makebox[0pt][r]{% % \pagemark % \enskip % \raisebox{0pt}[\ht\strutbox][\dp\strutbox]{% % \rule[-\dp\strutbox]{\vrulewidth}{2\baselineskip}% Linie -- Offset,Breite,Höhe % }% % \hspace{\marginparsep}% % }% % } \usepackage{blindtext} \usepackage[raiselinks,colorlinks,bookmarks,pageanchor,hyperindex]{hyperref} \hypersetup{linkcolor=RoyalBlue} \begin{document} \markboth{Inhaltsverzeichnis}{Inhaltsverzeichnis} \setcounter{page}{1} \pagenumbering{Roman} \tableofcontents \setcounter{tocdepth}{3} \clearpage \setcounter{page}{1} \pagenumbering{arabic} \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \Blinddocument \appendix \Blinddocument \end{document} Edit: here are some images to visualize the differences: EDIT: I just figured out (here) that the problem is that \ifnumbered{chapter} checks the value of secnumdepth which is not altered in the header, as far as I understood, and a redefinition of chaptermark is needed. My redefinition is obviously not enough for the intended result.

  • A hyperbolic triangle embedded in a saddle-shaped surface
    by Tony on August 16, 2018 at 5:49 pm

    This is the diagram I would like to recreate. (from https://en.wikipedia.org/wiki/Hyperbolic_triangle) From Is there any easy way to draw a ruled surface like a hyperbolic paraboloid in TikZ?, I found a way to draw the saddle-shaped surface. Is there a way to draw the triangle on it? And get the colours/transparency like the picture? \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot3 [surf,shader=flat,draw=black] {x^2-y^2}; \end{axis} \end{tikzpicture} \end{document}

  • Clipping more complicated shapes in TikZ
    by user121799 on December 31, 2017 at 2:33 am

    I have tried to understand TikZ clipping better but I am stuck. I'd like to clip the area bounded by the blue contour in this picture: Unfortunately, the MWE is rather lengthy, and based on Alain Matthes cool macros and some additional macros from the answer here. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,fadings,decorations.pathreplacing,shadings} \usepackage{verbatim} \newcommand\pgfmathsinandcos[3]{% \pgfmathsetmacro#1{sin(#3)}% \pgfmathsetmacro#2{cos(#3)}% } \newcommand\LongitudePlane[3][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#2} % elevation \pgfmathsinandcos\sint\cost{#3} % azimuth \tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}} } \newcommand\LatitudePlane[3][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#2} % elevation \pgfmathsinandcos\sint\cost{#3} % latitude \pgfmathsetmacro\yshift{\RadiusSphere*\cosEl*\sint} \tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} % } \newcommand\NewLatitudePlane[4][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#3} % elevation \pgfmathsinandcos\sint\cost{#4} % latitude \pgfmathsetmacro\yshift{#2*\cosEl*\sint} \tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} % } \newcommand\DrawLongitudeCircle[2][1]{ \LongitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=#1}} % angle of "visibility" \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} % \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1); \draw[current plane,opacity=0.4] (\angVis-180:1) arc (\angVis-180:\angVis:1); } \newcommand\DrawLongitudeArc[4][black]{ \LongitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} % \pgfmathsetmacro\angA{mod(max(\angVis,#3),360)} % \pgfmathsetmacro\angB{mod(min(\angVis+180,#4),360} % \draw[current plane,#1,opacity=0.4] (#3:\RadiusSphere) arc (#3:#4:\RadiusSphere); \draw[current plane,#1] (\angA:\RadiusSphere) arc (\angA:\angB:\RadiusSphere); }% \newcommand\DrawLatitudeCircle[2][1]{ \LatitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=#1}} \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1); \draw[current plane,opacity=0.4] (180-\angVis:1) arc (180-\angVis:\angVis:1); } \newcommand\DrawLatitudeArc[4][black]{ \LatitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \pgfmathsetmacro\angA{max(min(\angVis,#3),-\angVis-180)} % \pgfmathsetmacro\angB{min(\angVis,#4)} % \draw[current plane,#1,opacity=0.4] (#3:\RadiusSphere) arc (#3:#4:\RadiusSphere); \draw[current plane,#1] (\angA:\RadiusSphere) arc (\angA:\angB:\RadiusSphere); } %% document-wide tikz options and styles \tikzset{% >=latex, % option for nice arrows inner sep=0pt,% outer sep=2pt,% mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt, fill=black,circle}% } \begin{document} \begin{tikzpicture} % "THE GLOBE" showcase \def\RadiusSphere{4} % sphere radius \def\angEl{20} % elevation angle \def\angAz{-20} % azimuth angle \shade[ball color = gray!40, opacity = 0.5] (0,0) circle (\RadiusSphere); \tikzset{ every path/.style={ color=black } } \DrawLatitudeArc[blue]{40}{-140}{-30} \DrawLongitudeArc[blue]{-140}{-30}{40} \DrawLatitudeArc[blue]{-30}{-140}{-30} \DrawLongitudeArc[blue]{-30}{-30}{40} \end{tikzpicture} \end{document} The problem is that, according to what I read, clip needs to be the only option of \draw, but this clashes with the way the arcs are drawn here. So I am wondering if there is a way to have both. EDIT Motivated by the great progress by John Kormylo, I tried (and to some extent succeeded) to find alternative ways of shading the area. They are based on this post, and require the spath package (run pdflatex spath.dtx). \documentclass{article} \usepackage{tikz} \usetikzlibrary{shadings} \usepackage{spath} % from https://tex.stackexchange.com/a/26664/121799 \usetikzlibrary{calc,fadings,decorations.pathreplacing,shadings} \usepackage{verbatim} \newcommand\pgfmathsinandcos[3]{% \pgfmathsetmacro#1{sin(#3)}% \pgfmathsetmacro#2{cos(#3)}% } \newcommand\LongitudePlane[3][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#2} % elevation \pgfmathsinandcos\sint\cost{#3} % azimuth \tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}} } \newcommand\LatitudePlane[3][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#2} % elevation \pgfmathsinandcos\sint\cost{#3} % latitude \pgfmathsetmacro\yshift{\RadiusSphere*\cosEl*\sint} \tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} % } \newcommand\NewLatitudePlane[4][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#3} % elevation \pgfmathsinandcos\sint\cost{#4} % latitude \pgfmathsetmacro\yshift{#2*\cosEl*\sint} \tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} % } \newcommand\DrawLongitudeCircle[2][1]{ \LongitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=#1}} % angle of "visibility" \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} % \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1); \draw[current plane,opacity=0.4] (\angVis-180:1) arc (\angVis-180:\angVis:1); } \newcommand\DrawLongitudeArc[4][black]{ \LongitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} % \pgfmathsetmacro\angA{mod(max(\angVis,#3),360)} % \pgfmathsetmacro\angB{mod(min(\angVis+180,#4),360} % \draw[current plane,#1,opacity=0.4] (#3:\RadiusSphere) arc (#3:#4:\RadiusSphere); \draw[current plane,#1] (\angA:\RadiusSphere) arc (\angA:\angB:\RadiusSphere); }% \newcommand\ClipLongitudeArc[4][black]{ \LongitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} % \pgfmathsetmacro\angA{mod(max(\angVis,#3),360)} % \pgfmathsetmacro\angB{mod(min(\angVis+180,#4),360} % \path[save path=\tmppathI,current plane,#1,opacity=0.4] (#3:\RadiusSphere) arc (#3:#4:\RadiusSphere); \path[save path=\tmppathII,current plane,#1] (\angA:\RadiusSphere) arc (\angA:\angB:\RadiusSphere); }% \newcommand\ClipLongitudeArcReverse[4][black]{ \LongitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} % \pgfmathsetmacro\angA{mod(max(\angVis,#3),360)} % \pgfmathsetmacro\angB{mod(min(\angVis+180,#4),360} % \path[save path=\tmppathI,current plane,#1,opacity=0.4] (#4:\RadiusSphere) arc (#4:#3:\RadiusSphere); \path[save path=\tmppathII,current plane,#1] (\angB:\RadiusSphere) arc (\angB:\angA:\RadiusSphere); }% \newcommand\DrawLatitudeCircle[2][1]{ \LatitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=#1}} \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1); \draw[current plane,opacity=0.4] (180-\angVis:1) arc (180-\angVis:\angVis:1); } \newcommand\DrawLatitudeArc[4][black]{ \LatitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \pgfmathsetmacro\angA{max(min(\angVis,#3),-\angVis-180)} % \pgfmathsetmacro\angB{min(\angVis,#4)} % \draw[current plane,#1,opacity=0.4] (#3:\RadiusSphere) arc (#3:#4:\RadiusSphere); \draw[current plane,#1] (\angA:\RadiusSphere) arc (\angA:\angB:\RadiusSphere); } \newcommand\ClipLatitudeArc[4][black]{ \LatitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \pgfmathsetmacro\angA{max(min(\angVis,#3),-\angVis-180)} % \pgfmathsetmacro\angB{min(\angVis,#4)} % \path[save path=\tmppathI,current plane,#1,opacity=0.4] (#3:\RadiusSphere) arc (#3:#4:\RadiusSphere); \path[save path=\tmppathII,current plane,#1] (\angA:\RadiusSphere) arc (\angA:\angB:\RadiusSphere); } \newcommand\ClipLatitudeArcReverse[4][black]{ \LatitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=1}} \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \pgfmathsetmacro\angA{max(min(\angVis,#3),-\angVis-180)} % \pgfmathsetmacro\angB{min(\angVis,#4)} % \path[save path=\tmppathI,current plane,#1,opacity=0.4] (#4:\RadiusSphere) arc (#4:#3:\RadiusSphere); \path[save path=\tmppathII,current plane,#1] (\angB:\RadiusSphere) arc (\angB:\angA:\RadiusSphere); } %% document-wide tikz options and styles \tikzset{% >=latex, % option for nice arrows inner sep=0pt,% outer sep=2pt,% mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt, fill=black,circle}% } \begin{document} \begin{tikzpicture} % "THE GLOBE" showcase \def\RadiusSphere{4} % sphere radius \def\angEl{20} % elevation angle \def\angAz{-20} % azimuth angle \shade[ball color = gray!40, opacity = 0.5] (0,0) circle (\RadiusSphere); \tikzset{ every path/.style={ color=black } } \ClipLatitudeArc[blue]{40}{-140}{-30} \pgfoonew \patha=new spath(\tmppathI) \pgfoonew \pathb=new spath(\tmppathII) \ClipLongitudeArc[blue]{-30}{40}{-40} \pgfoonew \pathc=new spath(\tmppathI) \pgfoonew \pathd=new spath(\tmppathII) \ClipLatitudeArc[blue]{-40}{-30}{-140} \pgfoonew \pathe=new spath(\tmppathI) \pgfoonew \pathf=new spath(\tmppathII) \ClipLongitudeArc[blue]{-140}{-30}{40} \pgfoonew \pathg=new spath(\tmppathI) \pgfoonew \pathh=new spath(\tmppathII) \patha.concatenate with lineto(,\pathc) \patha.concatenate with lineto(,\pathe) \patha.concatenate with lineto(,\pathg) \patha.close() \patha.use path with tikz(line width=1pt,draw=black,fill=blue,path fading=south) \end{tikzpicture} \end{document} Although this comes somewhat closer to what I wish to achieve, I am still puzzled that these paths can not be used for clippings. (This also means that John Kormylo's approach is much cleaner and better.) And I am wondering if there is a cleaner or at least alternative way that does not rely on the inofficial spath package.

  • rotate node in 3D
    by Fadwa on November 19, 2015 at 6:54 am

    I am trying to draw this 3D shape I draw the 4 arrows and the cylinder, but can't rotate the arrows in 3D to put them on the top. \documentclass{standalone} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usetikzlibrary{shapes.arrows} \begin{document} %,rotate around={30:(0,1,1)} \begin{tikzpicture} \node[cylinder, draw=white,fill=blue, shape aspect=0.7,rotate=90,minimum height=0.7cm, minimum width=2cm] {hh}; \node [fill=red,single arrow, draw=none, rotate=90,minimum height=1cm,minimum width=0.7cm]at(0,0) {}; \node [fill=blue,single arrow, draw=none, rotate=-90,minimum height=1cm,minimum width=0.7cm] at (0,1.5) {}; \node [fill=red,single arrow, draw=none, rotate=-180,minimum height=1cm,minimum width=0.7cm]at(-0.75,0.7) {}; \node [fill=blue,single arrow, draw=none, rotate=-360,minimum height=1cm,minimum width=0.7cm] at (0.75,0.7) {}; \end{tikzpicture} \end{document}

  • Spiral on a truncated cone
    by Dinis Nunes on September 1, 2015 at 2:33 pm

    I need to plot a spiral around an inverted truncated cone, starting and ending at the centre of both bases. Something like this: I've searched and found a similar solution, but for cylinders only: Helix on a cylinder I couldn't adapt it to my geometric shape in question, so any help would be appreciated. The code for the cone only: \documentclass[border=0.125cm]{standalone} \usepackage{tikz} \usetikzlibrary{3d,calc} \begin{document} \begin{tikzpicture} \draw (-1,0) arc (180:370:2cm and 1cm); \draw (-1,0) arc (180:10:2cm and 1cm); \draw (0,-3) arc (180:360:1cm and 0.5cm); \draw[dashed] (0,-3) arc (180:0:1cm and 0.5cm); \draw(0,-3) -- (-0.97,-0.18); \draw(2,-3) -- (2.97,-0.18); \shade[left color=blue!5!white,right color=blue!60!white,opacity=0.3] (-0.97,-0.18) arc (190:350:2 and 1) -- (2,-3) arc (360:180:1cm and 0.5cm) -- cycle; \shade[left color=blue!5!white,right color=blue!60!white,opacity=0.3] (1,0) ellipse (2cm and 1cm); \draw[dashed] (0.7,-3) arc (180:0:0.3cm and 0.15cm); \draw[dashed] (0.7,-3) arc (180:360:0.3cm and 0.15cm); \end{tikzpicture} \end{document} Thanks in advance, Dinis Nunes EDIT: Following Ignasi suggestion, I've added a spiral function, but my goal was making the line follow closely the wall of the cone. Code: \node[xshift=1cm,yshift=-3cm] (dummy) {}; \draw[densely dotted,scale=0.09,variable=\x,shift=(dummy)] plot[domain = 0:10*pi, samples = 400] ({\x*0.6*sin(0.3*pi*deg(\x))},{\x},{\x*0.6*cos(0.3*pi*deg(\x)});

  • Parabolic Moebius map on sphere using tikz
    by 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)

  • Improving the visual appearance of a truncated cone in TikZ
    by Ingo on August 27, 2014 at 4:19 pm

    I have drawn a truncated cone in TikZ and am generally happy with the result. Here is the output and an MWE: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[>=latex] \fill[fill=gray!50] (1,0) ellipse (0.166 and 0.5); \fill[fill=gray!50] (4,0) ellipse (0.498 and 1.5); \fill[fill=gray!50] (1, 0.5) -- (4, 1.5) -- (4, -1.5) -- (1, -0.5) -- (1, 0.5); \draw[thick,->] (0,0,0) -- (5,0,0) node[anchor=west]{$z$}; \draw[thick,->] (0,0,0) -- (0,2,0) node[anchor=south]{$x$}; \draw[thick,->] (0,0,0) -- (0,0,2) node[anchor=north east]{$y$}; \draw[semithick] (1,0) ellipse (0.166 and 0.5); \draw[semithick] (4,0) ellipse (0.498 and 1.5); \draw (1, 0.5) -- (4, 1.5); \draw (1, -0.5) -- (4, -1.5); \end{tikzpicture} \end{document} However, I think that there is room for improvement. Here are some things that I could not figure out: How can we (automatically) dash the z-axis where it should be hidden, as well as part of the ellipse of one of the sides, which should not be visible? Would there be a sane way of adding some shading to the drawing, that would add depth? Can you help me out with these points?

  • Rectangles around cells in table
    by James on October 23, 2013 at 6:48 am

    I asked a question here but, rather stupidly, added extra information after it had been answered. My additional question is this: I have a table with varying lengths of words. I want to encircle different groups of cells, including diagonals. If possible, it would be great if the rectangles don't overlap each other where possible. I looked at the answer here, which, whilst tedious, worked except for the overlap. This is where I've got to so far: \documentclass[fleqn,12pt,a4paper,landscape]{article} \usepackage{tikz} \usepackage{tabularx} \begin{document} % Introduce a new counter for counting the nodes needed for circling \newcounter{nodecount} % Command for making a new node and naming it according to the nodecount counter \newcommand\tabnode[1]{\addtocounter{nodecount}{1} \tikz \node (\arabic{nodecount}) {#1};} % Some options common to all the nodes and paths \tikzstyle{every picture}+=[remember picture,baseline] \tikzstyle{every node}+=[inner sep=0pt,anchor=base, minimum width=1.8cm,align=center,text depth=.25ex,outer sep=1.5pt] \tikzstyle{every path}+=[thick, rounded corners] \begin{table}[ht] \begin{minipage}[b]{1 \linewidth}\centering \begin{tabular}{cccccc} % Turn the cells needed for defining the circling paths into nodes with our custom command \tabnode{Long ago}& \tabnode{A few days ago}& \tabnode{Day before yesterday}& \tabnode{Yesterday} & & \\ & & & & \tabnode{Today} & \tabnode{Now}\\ \tabnode{Long time in the future}& \tabnode{A few days on}& \tabnode{Day after tomorrow}& \tabnode{Tomorrow} & & \\ \end{tabular} \end{minipage} \begin{tikzpicture}[overlay] % Define the circle paths \draw [blue](1.north west) -- (1.north east) -| (7.north east) |- (7.south west) |- (1.north west); \draw [red](8.south west) -| (2.north east) -| (2.south west) |- (8.south west); \draw [yellow](9.south west) -| (3.north east) -| (3.south west) |- (9.south west); \draw [green](8.south west) -| (3.north east) -| (2.south west) |- (8.south west); \end{tikzpicture} \end{table} \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End:

  • Helix on a cylinder
    by Grimolatto on August 24, 2013 at 8:49 am

    I want to plot geodesics on a cylinder. These are straight lines, circles or helices. I can plot the first two, but I don't know how to draw the helices. To be precise, I would like to know how to draw an helix on this cylinder (passing thru two points A and B, but the location of the points is not relevant), using TikZ exclusively (maybe with pgfplots, but without using pstricks): \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node [cylinder,rotate=90,draw,aspect=2,minimum width=2cm,minimum height=3.5cm](C){}; \draw[fill] (-0.5,-0.5) circle [radius=0.045]node[below]{$A$}; \draw[fill] (0.5,0.75) circle [radius=0.045]node[below]{$B$}; \end{tikzpicture} \end{document}

  • Is there a way to show the version of a document as seen by a colour blind reader?
    by alexwlchan on July 5, 2013 at 2:25 pm

    I’m creating a number of coloured grids with TikZ, which look something like this: This exercise is designed to demonstrate reflections and rotational symmetry. It’s important that the individual colours be distinguishable, and a problem in the past has been colour blindness. Readers who are colour blind can’t distinguish the individual colours, which makes it harder to see the symmetries. I’m using the tool Colour Oracle to test the colours against deuteranopia (green deficiency), protanopia (red deficiency) and tritanopia (blue deficiency), but I’d like to be able to output a PDF that retains these filters, without recalculating every colour by hand. Is there a package that I can use at compile time, or a PDF tool that allows me to simulate colour blindness? As a bonus, the ability to simulate the desaturation that comes from using a projector in a lit room would also be useful. (If anybody is interested in the exercise the original version is a problem on the NRICH website. I’m updating it as part of my summer work.)

  • How to plot functions like ‎‎‎‎‎x=f(y)‎‎ using TikZ?
    by Sisabe on March 27, 2013 at 3:48 pm

    To plot functions in the form of y=f(x), we simply write‎ ‎\draw ‎[‎smooth,‎samples=100‎,domain=0:‎‎2‎‎] ‎plot(\x,‎‎‎‎‎‎‎‎{(\x)...‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎});‎‎ But how about functions like x=f(y)? How to plot them? How to specify their domains ‎in terms of "y"‎? \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw [smooth,samples=100,domain=0:2] plot(???); \end{tikzpicture} \end{document}