TikZ
- Rendering tikz code as an image in a separate file, then using \includegraphics in the main file, whilst complying with PDF/UAby Carsten Yeung on September 18, 2025 at 4:57 am
I'm typing some lecture notes in LaTeX, and I want the document to be accessible (PDF/UA compliant). Extra guidance on LaTeX PDF-accessibility would be helpful. My main point of concern is with figures, namely tikz pictures. Right now I have separate files containing only a block tikz code (i.e. they are not meant to be compiled as PDF on their own). Here is the code for one of the pictures (called 1-Robot_arm.tex): \tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: \path (0,499); %set diagram left start at 0, and has height of 499 %Shape: Rectangle [id:dp7996705832338366] \draw [fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (292,271.57) -- (418.85,271.57) -- (418.85,292.03) -- (292,292.03) -- cycle ; %Shape: Triangle [id:dp46766492743083177] \draw (354.27,240.74) -- (372.57,271.05) -- (335.97,271.05) -- cycle ; %Shape: Ellipse [id:dp7340933088598973] \draw (349.44,235.75) .. controls (349.44,232.99) and (351.61,230.75) .. (354.27,230.75) .. controls (356.94,230.75) and (359.1,232.99) .. (359.1,235.75) .. controls (359.1,238.5) and (356.94,240.74) .. (354.27,240.74) .. controls (351.61,240.74) and (349.44,238.5) .. (349.44,235.75) -- cycle ; %Shape: Ellipse [id:dp005973911761530171] \draw (415.53,188.09) .. controls (415.53,185.33) and (417.69,183.1) .. (420.36,183.1) .. controls (423.02,183.1) and (425.19,185.33) .. (425.19,188.09) .. controls (425.19,190.85) and (423.02,193.08) .. (420.36,193.08) .. controls (417.69,193.08) and (415.53,190.85) .. (415.53,188.09) -- cycle ; %Shape: Ellipse [id:dp11916740467785225] \draw (480.84,219.07) .. controls (480.84,216.31) and (483,214.07) .. (485.67,214.07) .. controls (488.34,214.07) and (490.5,216.31) .. (490.5,219.07) .. controls (490.5,221.82) and (488.34,224.06) .. (485.67,224.06) .. controls (483,224.06) and (480.84,221.82) .. (480.84,219.07) -- cycle ; %Shape: Ellipse [id:dp5089566248001661] \draw (535.4,159.49) .. controls (535.4,156.74) and (537.56,154.5) .. (540.23,154.5) .. controls (542.9,154.5) and (545.06,156.74) .. (545.06,159.49) .. controls (545.06,162.25) and (542.9,164.49) .. (540.23,164.49) .. controls (537.56,164.49) and (535.4,162.25) .. (535.4,159.49) -- cycle ; %Straight Lines [id:da24129898895388247] \draw (358.74,232) -- (415.6,190.7) ; %Straight Lines [id:da7156324427284178] \draw (424.83,189.9) -- (481.69,216.12) ; %Straight Lines [id:da3344673958665092] \draw (488.6,215.32) -- (537.78,162.9) ; %Shape: Rectangle [id:dp7997395567781902] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (573,274.57) -- (699.85,274.57) -- (699.85,295.03) -- (573,295.03) -- cycle ; %Shape: Triangle [id:dp8751414593827821] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (635.27,243.74) -- (653.57,274.05) -- (616.97,274.05) -- cycle ; %Shape: Ellipse [id:dp397369418775106] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (630.44,238.75) .. controls (630.44,235.99) and (632.61,233.75) .. (635.27,233.75) .. controls (637.94,233.75) and (640.1,235.99) .. (640.1,238.75) .. controls (640.1,241.5) and (637.94,243.74) .. (635.27,243.74) .. controls (632.61,243.74) and (630.44,241.5) .. (630.44,238.75) -- cycle ; %Shape: Ellipse [id:dp8015587667504429] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (696.53,191.09) .. controls (696.53,188.33) and (698.69,186.1) .. (701.36,186.1) .. controls (704.02,186.1) and (706.19,188.33) .. (706.19,191.09) .. controls (706.19,193.85) and (704.02,196.08) .. (701.36,196.08) .. controls (698.69,196.08) and (696.53,193.85) .. (696.53,191.09) -- cycle ; %Shape: Ellipse [id:dp9016528494432301] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (761.84,222.07) .. controls (761.84,219.31) and (764,217.07) .. (766.67,217.07) .. controls (769.34,217.07) and (771.5,219.31) .. (771.5,222.07) .. controls (771.5,224.82) and (769.34,227.06) .. (766.67,227.06) .. controls (764,227.06) and (761.84,224.82) .. (761.84,222.07) -- cycle ; %Shape: Ellipse [id:dp4603779754744257] \draw (816.4,162.49) .. controls (816.4,159.74) and (818.56,157.5) .. (821.23,157.5) .. controls (823.9,157.5) and (826.06,159.74) .. (826.06,162.49) .. controls (826.06,165.25) and (823.9,167.49) .. (821.23,167.49) .. controls (818.56,167.49) and (816.4,165.25) .. (816.4,162.49) -- cycle ; %Straight Lines [id:da8780549111571742] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (639.74,235) -- (696.6,193.7) ; %Straight Lines [id:da9661299447896011] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (705.83,192.9) -- (762.69,219.12) ; %Straight Lines [id:da968665704316749] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (769.6,218.32) -- (818.78,165.9) ; %Straight Lines [id:da875843748729442] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (641,239) -- (706,239) ; %Straight Lines [id:da962155566323262] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (706,187) -- (764.5,142) ; %Straight Lines [id:da5621792793143086] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (771,224) -- (831.5,253) ; %Curve Lines [id:da962296076111877] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (687,237) .. controls (687.97,237) and (690.82,225.71) .. (680.04,210.43) ; \draw [shift={(679,209)}, rotate = 53.13] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da056932981651514614] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (797.5,237) .. controls (797.5,237.97) and (803.15,217.3) .. (789.79,202.37) ; \draw [shift={(788.5,201)}, rotate = 45] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da7809394891991979] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (733.5,168) .. controls (733.5,168.97) and (742.91,182.17) .. (736.17,202.13) ; \draw [shift={(735.5,204)}, rotate = 290.85] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; % Text Node \draw (332,214.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$O$}; % Text Node \draw (400,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 17; green, 1; blue, 1 } ,opacity=1 ] {$A$}; % Text Node \draw (493,223.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 19; green, 1; blue, 1 } ,opacity=1 ] {$B$}; % Text Node \draw (550,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$C$}; % Text Node \draw (693,212.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 24; green, 2; blue, 2 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{\alpha _{1}}$}; % Text Node \draw (741,167.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.11,0,0}{\alpha _{2}}$}; % Text Node \draw (806,204.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.06,0,0}{\alpha _{3}}$}; % Text Node \draw (745,192.4) node [anchor=north west][inner sep=0.75pt] [font=\footnotesize,color={rgb, 255:red, 241; green, 16; blue, 16 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{-}$}; % Text Node \draw (652,193.4) node [anchor=north west][inner sep=0.75pt] {$l_{1}$}; % Text Node \draw (729,208.4) node [anchor=north west][inner sep=0.75pt] {$l_{2}$}; % Text Node \draw (784,167.4) node [anchor=north west][inner sep=0.75pt] {$l_{3}$}; \end{tikzpicture} and I insert them into the main document like this: \DocumentMetadata{ lang=en, uncompress, testphase=phase-III, pdfstandard = ua-1, pdfversion = 1.7 } \documentclass{article} \usepackage{amsmath, amssymb, enumerate, framed, multicol, tikz, amsthm, multirow, microtype,comment,float,verbatim,cancel} \usepackage[mode=buildnew]{standalone} \usepackage[margin=1in]{geometry} \usepackage[hidelinks]{hyperref} \usepackage{graphicx} \usetikzlibrary{matrix, positioning} \usetikzlibrary{calc} \usepackage{tagpdf} \tagpdfsetup{tabsorder=structure} \hypersetup{ pdflang={en-US}, pdftitle={Robot Kinematics and Dynamics Notes}, pdfdisplaydoctitle=true, pdfauthor={Carsten}, pdfsubject={Robot Kinematics and Dynamics}, pdfkeywords={Accessibility, LaTeX} } \begin{document} \begin{center} \input{1-Robot_arm} \end{center} \end{document} Inserting figures like this, and writing everything else up as normal, allowed the generated PDF to pass PAC (PDF Accessibility Checker) requirements. However, instead of directly inputting tikz code into my main document, I want to render the tikz pictures as separate PDFs, and use \includegraphics in the figure environment (so I can reference them) in the main document to display the picture. Note that just wrapping the \input{1-Robot_arm} in the figure environment gives a "no bounding box" error in PAC. I referred to this StackExchange post 'Standalone' TikZ pictures and tried applying it to my own code with the figure environment and adding alt-text (compiling with LuaLaTeX). The 1-Robot_arm.tex file: \documentclass[crop,tikz]{standalone} \begin{document} \tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: \path (0,499); %set diagram left start at 0, and has height of 499 %Shape: Rectangle [id:dp7996705832338366] \draw [fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (292,271.57) -- (418.85,271.57) -- (418.85,292.03) -- (292,292.03) -- cycle ; %Shape: Triangle [id:dp46766492743083177] \draw (354.27,240.74) -- (372.57,271.05) -- (335.97,271.05) -- cycle ; %Shape: Ellipse [id:dp7340933088598973] \draw (349.44,235.75) .. controls (349.44,232.99) and (351.61,230.75) .. (354.27,230.75) .. controls (356.94,230.75) and (359.1,232.99) .. (359.1,235.75) .. controls (359.1,238.5) and (356.94,240.74) .. (354.27,240.74) .. controls (351.61,240.74) and (349.44,238.5) .. (349.44,235.75) -- cycle ; %Shape: Ellipse [id:dp005973911761530171] \draw (415.53,188.09) .. controls (415.53,185.33) and (417.69,183.1) .. (420.36,183.1) .. controls (423.02,183.1) and (425.19,185.33) .. (425.19,188.09) .. controls (425.19,190.85) and (423.02,193.08) .. (420.36,193.08) .. controls (417.69,193.08) and (415.53,190.85) .. (415.53,188.09) -- cycle ; %Shape: Ellipse [id:dp11916740467785225] \draw (480.84,219.07) .. controls (480.84,216.31) and (483,214.07) .. (485.67,214.07) .. controls (488.34,214.07) and (490.5,216.31) .. (490.5,219.07) .. controls (490.5,221.82) and (488.34,224.06) .. (485.67,224.06) .. controls (483,224.06) and (480.84,221.82) .. (480.84,219.07) -- cycle ; %Shape: Ellipse [id:dp5089566248001661] \draw (535.4,159.49) .. controls (535.4,156.74) and (537.56,154.5) .. (540.23,154.5) .. controls (542.9,154.5) and (545.06,156.74) .. (545.06,159.49) .. controls (545.06,162.25) and (542.9,164.49) .. (540.23,164.49) .. controls (537.56,164.49) and (535.4,162.25) .. (535.4,159.49) -- cycle ; %Straight Lines [id:da24129898895388247] \draw (358.74,232) -- (415.6,190.7) ; %Straight Lines [id:da7156324427284178] \draw (424.83,189.9) -- (481.69,216.12) ; %Straight Lines [id:da3344673958665092] \draw (488.6,215.32) -- (537.78,162.9) ; %Shape: Rectangle [id:dp7997395567781902] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][fill={rgb, 255:red, 204; green, 199; blue, 199 } ,fill opacity=1 ] (573,274.57) -- (699.85,274.57) -- (699.85,295.03) -- (573,295.03) -- cycle ; %Shape: Triangle [id:dp8751414593827821] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (635.27,243.74) -- (653.57,274.05) -- (616.97,274.05) -- cycle ; %Shape: Ellipse [id:dp397369418775106] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (630.44,238.75) .. controls (630.44,235.99) and (632.61,233.75) .. (635.27,233.75) .. controls (637.94,233.75) and (640.1,235.99) .. (640.1,238.75) .. controls (640.1,241.5) and (637.94,243.74) .. (635.27,243.74) .. controls (632.61,243.74) and (630.44,241.5) .. (630.44,238.75) -- cycle ; %Shape: Ellipse [id:dp8015587667504429] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (696.53,191.09) .. controls (696.53,188.33) and (698.69,186.1) .. (701.36,186.1) .. controls (704.02,186.1) and (706.19,188.33) .. (706.19,191.09) .. controls (706.19,193.85) and (704.02,196.08) .. (701.36,196.08) .. controls (698.69,196.08) and (696.53,193.85) .. (696.53,191.09) -- cycle ; %Shape: Ellipse [id:dp9016528494432301] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (761.84,222.07) .. controls (761.84,219.31) and (764,217.07) .. (766.67,217.07) .. controls (769.34,217.07) and (771.5,219.31) .. (771.5,222.07) .. controls (771.5,224.82) and (769.34,227.06) .. (766.67,227.06) .. controls (764,227.06) and (761.84,224.82) .. (761.84,222.07) -- cycle ; %Shape: Ellipse [id:dp4603779754744257] \draw (816.4,162.49) .. controls (816.4,159.74) and (818.56,157.5) .. (821.23,157.5) .. controls (823.9,157.5) and (826.06,159.74) .. (826.06,162.49) .. controls (826.06,165.25) and (823.9,167.49) .. (821.23,167.49) .. controls (818.56,167.49) and (816.4,165.25) .. (816.4,162.49) -- cycle ; %Straight Lines [id:da8780549111571742] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (639.74,235) -- (696.6,193.7) ; %Straight Lines [id:da9661299447896011] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (705.83,192.9) -- (762.69,219.12) ; %Straight Lines [id:da968665704316749] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (769.6,218.32) -- (818.78,165.9) ; %Straight Lines [id:da875843748729442] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (641,239) -- (706,239) ; %Straight Lines [id:da962155566323262] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (706,187) -- (764.5,142) ; %Straight Lines [id:da5621792793143086] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (771,224) -- (831.5,253) ; %Curve Lines [id:da962296076111877] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (687,237) .. controls (687.97,237) and (690.82,225.71) .. (680.04,210.43) ; \draw [shift={(679,209)}, rotate = 53.13] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da056932981651514614] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (797.5,237) .. controls (797.5,237.97) and (803.15,217.3) .. (789.79,202.37) ; \draw [shift={(788.5,201)}, rotate = 45] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; %Curve Lines [id:da7809394891991979] \draw [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ] (733.5,168) .. controls (733.5,168.97) and (742.91,182.17) .. (736.17,202.13) ; \draw [shift={(735.5,204)}, rotate = 290.85] [color={rgb, 255:red, 20; green, 2; blue, 2 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ; % Text Node \draw (332,214.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$O$}; % Text Node \draw (400,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 17; green, 1; blue, 1 } ,opacity=1 ] {$A$}; % Text Node \draw (493,223.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 19; green, 1; blue, 1 } ,opacity=1 ] {$B$}; % Text Node \draw (550,164.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 14; green, 1; blue, 1 } ,opacity=1 ] {$C$}; % Text Node \draw (693,212.4) node [anchor=north west][inner sep=0.75pt] [color={rgb, 255:red, 24; green, 2; blue, 2 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{\alpha _{1}}$}; % Text Node \draw (741,167.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.11,0,0}{\alpha _{2}}$}; % Text Node \draw (806,204.4) node [anchor=north west][inner sep=0.75pt] {$\textcolor[rgb]{0.06,0,0}{\alpha _{3}}$}; % Text Node \draw (745,192.4) node [anchor=north west][inner sep=0.75pt] [font=\footnotesize,color={rgb, 255:red, 241; green, 16; blue, 16 } ,opacity=1 ] {$\textcolor[rgb]{0.07,0,0}{-}$}; % Text Node \draw (652,193.4) node [anchor=north west][inner sep=0.75pt] {$l_{1}$}; % Text Node \draw (729,208.4) node [anchor=north west][inner sep=0.75pt] {$l_{2}$}; % Text Node \draw (784,167.4) node [anchor=north west][inner sep=0.75pt] {$l_{3}$}; \end{tikzpicture} \end{document} And main.tex: \DocumentMetadata{ lang=en, uncompress, testphase=phase-III, pdfstandard = ua-1, pdfversion = 1.7 } \documentclass{article} \usepackage{amsmath, amssymb, enumerate, framed, multicol, tikz, amsthm, multirow, microtype,comment,float,verbatim,cancel} \usepackage[mode=buildnew]{standalone} \usepackage[margin=1in]{geometry} \usepackage[hidelinks]{hyperref} \usepackage{graphicx} \usetikzlibrary{matrix, positioning} \usetikzlibrary{calc} \usepackage{tagpdf} \tagpdfsetup{tabsorder=structure} \hypersetup{ pdflang={en-US}, pdftitle={Robot Kinematics and Dynamics Notes}, pdfdisplaydoctitle=true, pdfauthor={Carsten}, pdfsubject={Robot Kinematics and Dynamics}, pdfkeywords={Accessibility, LaTeX} } \begin{document} \begin{figure}[H] \centering \includegraphics[width=\linewidth, alt={Robot arm schematic}]{1-Robot_arm.tex} \end{figure} \end{document} But putting it through PAC receives the "Characters in text object cannot be mapped to unicode" error. Whilst constructing this minimal-working example (the above two code blocks) in a new project, I ran the main PDF through PAC, and it strangely passed all criteria, even though I effectively copied-and-pasted the code from my original project. So, this problem can be caused by something else in the main document, but I don't know what.
- TikZ bounding box not calculated properly in standalone classby TheFox on September 17, 2025 at 10:37 am
I'm using tikz to create a figure with a ring and n nodes on it equally separated by an angle of 360° / n. Since I want the number of nodes to be arbitrary I defined a command which creates the tikzpicture: \newcommand{\drawfigure}[2]{% \def\n{#1} \begin{tikzpicture} \draw[dashed] (0,0) circle (\rring); \foreach \i in {0,...,\numexpr\n-1\relax}{ \pgfmathsetmacro{\angle}{360*\i/\n} \begin{scope}[shift={(\angle:\rring)}, rotate=\angle] \draw[fill=black!20] #2; \end{scope} } \end{tikzpicture} } where \rring is defined globally, the first argument is the number of nodes to create and the second the node to draw. For example if one wants circular/rectangular nodes he can pass as second argument the macro \nodecirc/\noderect: \def\nodecirc{% (0,0) circle (\rnode); } \def\noderect{% (-\rnode,-\rnode) rectangle (\rnode,\rnode); } The problem I stumbled across is related to the bounding box of tikzpictures for specific values of n, and only with the circular node. For example for n = 3 I obtain a white space above the upper node, but not below the lower one as in this picture (sorry for the white backgrounds, if I added a background color the bounding box would get bigger, just open the image in a new tab): a similar problem arises for n = 5: but not for n = 4: while as I said with the rectangular node everything works fine. The issue persists if I set the bounding box as \usetikzlibrary{bbox} \tikzset{% bezier bounding box } the only difference being now some nodes are cut off, for instance the lower one in the case n = 3: Here is a MWE: \documentclass[tikz]{standalone} %\usetikzlibrary{bbox} \tikzset{% %bezier bounding box } \def\rring{1} \def\rnode{0.4} \def\nodecirc{% (0,0) circle (\rnode); } \def\noderect{% (-\rnode,-\rnode) rectangle (\rnode,\rnode); } \newcommand{\drawfigure}[2]{% \def\n{#1} \begin{tikzpicture} \draw[dashed] (0,0) circle (\rring); \foreach \i in {1,...,\n}{ \pgfmathsetmacro{\angle}{360*\i/\n} \begin{scope}[shift={(\angle:\rring)}, rotate=\angle] \draw[fill=black!20] #2; \end{scope} } \end{tikzpicture} } \begin{document} \drawfigure{3}{\nodecirc} \drawfigure{4}{\nodecirc} \drawfigure{5}{\nodecirc} \drawfigure{3}{\noderect} \drawfigure{4}{\noderect} \drawfigure{5}{\noderect} \end{document} How can I solve the problem, possibly without setting manually the bounding box? Why does tikz behave like this, it shouldn't since every node is placed symmetrically with respect to the origin? EDIT: as suggested by @gernot the problem seems to be related to how the bounding box of each node is calculated. See these examples: for n = 3, and for n = 5, while in the case n = 4 every bounding box is computed correctly. The bounding boxes were drawn replacing the scope environment with: \begin{scope}[shift={(\angle:\rring)}, rotate=\angle, local bounding box=bbox] \draw[fill=black!20] #2; \end{scope} \draw[red] (bbox.south west) rectangle (bbox.north east); Still I don't understand where's the problem, and why symmetric nodes don't have symmetric bounding boxes...
- genealogytree: Reducing width of tree by zig-zagging siblingsby J...S on September 17, 2025 at 7:52 am
I have made a family tree using the geneologytree package like this: \documentclass{standalone} \usepackage[all]{genealogytree} \begin{document} \begin{genealogypicture}[ template=database traditional, ] parent[id=parents]{ p[id=father]{ male, name = {Jack Doe}, } p[id=mother]{ female, name = {Jane Doe}, } c[id=c1]{ female, name = {Jane Doe}, } c[id=c2]{ male, name = {Jack Doe}, } c[id=c3]{ male, name = {Jack Doe}, } g[id=c4]{ female, name = {Jane Doe}, } c[id=c5]{ female, name = {Jane Doe}, } c[id=c6]{ male, name = {Jack Doe}, } c[id=c7]{ male, name = {Jack Doe}, } } \end{genealogypicture} \end{document} This is the output: This picture is quite wide and I wish to make it fit into a thinner space. One way of doing this that I can think of is by changing the vertical position of the siblings so that the sibling nodes are arranged in a zig-zag manner. This would allow us the 'shrink' the horizontal space while still leaving enough room for the labels. Something like this: How can this be done? I am using the traditional database template.
- genealogytree: How to make `traditional database` tree grow horizontally?by J...S on September 17, 2025 at 7:28 am
I am making a family tree using the geneologytree package like this: \documentclass{standalone} \usepackage[all]{genealogytree} \begin{document} \begin{genealogypicture}[ template=database traditional, ] parent[id=parents]{ p[id=father]{ male, name = {Jack Doe}, } p[id=mother]{ female, name = {Jane Doe}, } c[id=c1]{ female, name = {Jane Doe}, } c[id=c2]{ male, name = {Jack Doe}, } c[id=c3]{ male, name = {Jack Doe}, } g[id=c4]{ female, name = {Jane Doe}, } c[id=c5]{ female, name = {Jane Doe}, } c[id=c6]{ male, name = {Jack Doe}, } c[id=c7]{ male, name = {Jack Doe}, } } \end{genealogypicture} \end{document} This is the output: I am using the traditional database template for a 'minimal' look. But is there a way to make this tree grow horizontally from the left to the right? Instead of growing from top to bottom? I tried using the timeflow=right option, but it seems that has no effect on the traditional database template. I tried genealogytree because that seemed to be most suited for drawing family trees. Perhaps I should be using something else?
- Has \subnode broken or am I doing something daft?by cfr on September 16, 2025 at 10:56 pm
The following code compiles without error but gives unexpected (to me) results. In particular, the labels never 'settle'. As far as I can tell, LaTeX perpetually reports that the labels may have changed. The positions of the nodes jump from place-to-place (sometimes on different pages) accordingly. Now I know \subnode[]{}{} works - or did work. So either I am doing something very silly or something has broken (probably very recently) or both. \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark,fit} \begin{document} \begin{tikzpicture} \node {a \subnode{a}{sub} node}; \node [fit=(a),draw,inner sep=0pt,] {}; \end{tikzpicture} \end{document} This is essentially copy-pasted from tikzmark's manual, but I cannot get it to work. Certainly tikzmark does not seem to have been updated recently. However, pgf/tikz is from 2025-08-29 v3.1.11a (3.1.11a), so perhaps something has changed there. Another suspect may be LaTeX if anything to do with \mathchoice might have changed recently, since \subnode uses this internally.
- Drawing vertical and horizontal vectors along a Bézier curve (without local rotation)by lukewarn on September 16, 2025 at 10:26 pm
I’m trying to annotate a quadratic Bézier* curve in TikZ with vectors. Right now I can draw normal vectors (red arrows) at multiple points along the curve using the decorations.markings library. Here is a minimal working example: \documentclass[tikz,border=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{decorations.markings,calc,arrows.meta} % <-- arrows.meta added \begin{document} \begin{tikzpicture} % Quadratic Bézier control points \coordinate (QB1) at (0,0); \coordinate (QB2) at (0,3); \coordinate (QB3) at (8,3); % Convert quadratic to cubic control points \path let \p1 = (QB1), \p2 = (QB2), \p3 = (QB3), \p4 = ({(1/3)*\x1 + (2/3)*\x2},{(1/3)*\y1 + (2/3)*\y2}), \p5 = ({(2/3)*\x2 + (1/3)*\x3},{(2/3)*\y2 + (1/3)*\y3}) in coordinate (QB_aux1) at (\p4) coordinate (QB_aux2) at (\p5); % The curve \draw[thick,black] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); % Normal vectors using arrows.meta syntax \draw[ postaction={ decorate, decoration={ markings, mark=between positions 0. and 1. step 0.1 with { \draw[color=red, -{Latex[length=1mm]}] (0,0) -- (0,0.5); } } } ] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); \end{tikzpicture} \end{document} Now, in addition to the red arrows (normals), I would like to draw vertical and horizontal arrows at the same positions. However, it seems that TikZ rotates every arrow into the local coordinate system of the decoration. As a result, I cannot find a way to get all arrows to stay vertical/horizontal in the global picture. Also, I don’t want the red vectors to become the vectorial sum of the horizontal and vertical components — they are all independent drawings. Question: How can I place these vertical and horizontal arrows at each marked position along the Bézier curve, aligned with the global axes, rather than with the curve’s local frame? * For some reason, if I use \draw[thick,black] (QB1) .. controls (QB2) .. (QB3); instead of \draw[thick,black] (QB1) .. controls (QB_aux1) and (QB_aux2) .. (QB3); the curve doesn't look like a quadratic Bèzier.
- Vertical dashed lines in tikz. Figure from Proofs Without Wordsby Richard on September 16, 2025 at 9:08 am
I’m trying to recreate a figure from Roger B. Nelsen’s Proofs Without Words: Exercises in Visual Thinking—specifically “Sums of Squares V” (Integer Sums, p. 81). My code gets everything right except the vertical dashed lines inside each unit square. Can these be drawn when using rectangle ++(1,1), or should I use a different approach? \documentclass[]{article} \usepackage [utf 8]{inputenc} \usepackage{soul} \usepackage {ulem} \usepackage{amsmath , bm} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{quotes,angles} \usetikzlibrary {arrows.meta} \usetikzlibrary{math} \usetikzlibrary {babel} \usetikzlibrary{calc} %for coordinate calc \usepackage{tikz,ifthen} \begin{document} \begin{tikzpicture}[x=1cm,y=1cm,yscale=-1] % neutralize \i and \j only within this block \begingroup \let\i\relax \let\j\relax %First rectangle \foreach \i in {-1} \foreach \j in {0} \draw (\i,\j) rectangle ++(1,1); %Second rectangle \foreach \i in {0,1}{ \foreach \j in {0,1}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Third rectangle \foreach \i in {2,3,4}{ \foreach \j in {0,1,2}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Fourth rectangle \foreach \i in {2,3,4}{ \foreach \j in {0,1,2}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Fifth rectangle \foreach \i in {5,6,7,8}{ \foreach \j in {0,1,2,3}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi } } %Sixth rectangle \foreach \i in {9,10,11,12,13}{ \foreach \j in {0,1,2,3,4}{ \ifnum\j=0\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=2\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else\ifnum\j=4\relax \filldraw[fill=gray!30,draw=black] (\i,\j) rectangle ++(1,1); \else \draw (\i,\j) rectangle ++(1,1); \fi\fi\fi } } \endgroup \end{tikzpicture} \end{document}
- Nodes within tcolorbox that are not recognizedby antonio de la rosa on September 16, 2025 at 8:21 am
Good morning: I am trying to reproduce the table at the end of page 394 of the manual. Essentially, I have summarized it to build an arrow that goes from the first tcbhightmath to the second, all within a tcolorbox. So far, I have not succeeded because the nodes are not recognized. I have tried with overlay, with after={code} and with tikz in different positions, inside and outside of the tcolorbox. It still doesn't work, so I appreciate any help. My last code is: \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \usepackage[many]{tcolorbox} % Estilo de resaltado en fórmulas \tcbset{highlight math style={ enhanced, colframe=blue!70!black, colback=blue!10, boxrule=1pt, arc=2pt, outer arc=2pt, fontupper=\normalsize, drop fuzzy shadow }} % Hacer que TikZ recuerde los nodos \tikzset{remember picture} \begin{document} \begin{tcolorbox}[enhanced, colback=white] \begin{align*} \tcbhighmath[remember as=fx]{f(x)} &= \int_{1}^{x} \frac{1}{t^2}\,dt \end{align*} \end{tcolorbox} \vspace{2cm} % solo para separar las cajas en el ejemplo \begin{tcolorbox}[enhanced, colback=white] \begin{align*} f(x) &= \tcbhighmath[remember as=resultado]{1 - \frac{1}{x}} \end{align*} \end{tcolorbox} % Flecha entre las dos cajas \begin{tikzpicture}[remember picture, overlay] \draw[red, thick, ->, bend left] (fx.south) to (resultado.north); \end{tikzpicture} \end{document}
- How to save and reuse a calculated distanceby Lucy on September 16, 2025 at 5:50 am
I want to draw two arcs in TikZ. Right now I’m using \path let to calculate the radius, but I’d like to store this value and reuse it later, so I don’t have to write the starting points every time. In particular, I want to calculate the distance 𝐴𝑆1 once, save it, and then use it as the radius when defining other points on the arc. I guess I should use \pgfmathsetmacro for this, but I’m not sure how. What is the best way to save a value (for example, the distance between two points) and reuse it in multiple \draw commands? I would like use for example \coordinate (K1) at (140:\n3). \documentclass[11pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[czech]{babel} \usepackage[T1]{fontenc} \usepackage{amsmath,amsfonts,amssymb,mathrsfs} \usepackage[cmyk]{xcolor} \usepackage{pgfplots} %grafy s použitím \begin{axis} ... \end{axis} \pgfplotsset{compat=newest} % 1.15 pro geogebru, potřeba pro vykrelsení grafů \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} \usetikzlibrary{babel,arrows,intersections,patterns,calc,angles,through} \pagestyle{empty} % % % \begin{document} % %%%DEFINE COLOR \definecolor{modra}{cmyk}{1,0,0,0} \definecolor{cerna}{cmyk}{0,0,0,1} \definecolor{bila}{cmyk}{0,0,0,0} % \begin{tikzpicture}[scale=1] \def\delka{2.1} \def\uhel{72} \coordinate (A) at (0,0); \coordinate (B) at (\delka,0); \coordinate (S) at ($(A)!1/2!(B)$); % \draw[-] (A) -- (B); \path[name path=rr] (A) -- (\uhel-90:\delka); \draw[dash pattern=on 6pt off 2pt on 1pt off 2pt,name path=osa,cerna!80] ($(S)!1.25cm!270:(A)$) -- ($(S)!1.25cm!90:(A)$) coordinate[very near end] (o); \path[name intersections={of=rr and osa,by=S1}]; \draw (S1) node {$+$}; % %%%arcs \draw[thick,shift={(S1)}] let \p1 = (A), \p2 = (S1), \n3 = {veclen(\x1-\x2,\y1-\y2)} in (180-15:\n3) arc (180-15:360+15:\n3); \draw[thick,shift={(S1)}] (140:\n3) arc (140:400:\n3); % %%%I use \path let \p2 = (S1) in coordinate (S2) at (\x2, {- \y2}); \draw (S2) node {$+$}; \draw[thick,shift={(S2)}] let \p4 = (A), \p5 = (S2), \n6 = {veclen(\x4-\x5,\y4-\y5)} in (180+15:\n6) arc (180+15:-15:\n6); \draw[fill=blue!25] (A) circle (2pt); \draw[fill=blue!25] (B) circle (2pt); % % \end{tikzpicture} % \end{document}
- Pressure representation: additions to a graph from https://tikz.net/fluid_dynamics_laminar/by Sebastiano on September 15, 2025 at 8:16 pm
I have modificated a bit this code from this link https://tikz.net/fluid_dynamics_laminar/ \documentclass[border=3pt,tikz]{standalone} \usepackage{physics} \usepackage{tikz} \usepackage[outline]{contour} % glow around text \usetikzlibrary{patterns,decorations.pathmorphing} \usetikzlibrary{decorations.markings} \usetikzlibrary{arrows.meta} \usetikzlibrary{calc} \tikzset{>=latex} \contourlength{1.1pt} \colorlet{mydarkblue}{blue!40!black} \colorlet{myblue}{blue!70!black} \colorlet{myred}{red!65!black} \colorlet{myorange}{orange!90!black!90} \colorlet{vcol}{green!45!black} \colorlet{watercol}{blue!80!cyan!10!white} \colorlet{darkwatercol}{blue!80!cyan!80!black!30!white} \colorlet{metalcol}{blue!25!black!30!white} \tikzstyle{piston}=[blue!50!black,top color=blue!30,bottom color=blue!50,middle color=blue!20,shading angle=0] \tikzstyle{water}=[draw=mydarkblue,rounded corners=0.1,top color=watercol!90,bottom color=watercol!90!black,middle color=watercol!50,shading angle=20] \tikzstyle{horizontal water}=[water,top color=watercol!90!black!90,bottom color=watercol!90!black!90,middle color=watercol!80,shading angle=0] \tikzstyle{metal}=[draw=metalcol!10!black,rounded corners=0.1,top color=metalcol,bottom color=metalcol!80!black,shading angle=10] \tikzstyle{vvec}=[->,very thick,vcol,line cap=round] \tikzstyle{force}=[->,myred,very thick,line cap=round] \tikzstyle{width}=[{Latex[length=4,width=3]}-{Latex[length=4,width=3]}] \def\tick#1#2{\draw[thick] (#1)++(#2:0.12) --++ (#2-180:0.24)} \begin{document} % PRESSURE \begin{tikzpicture}[x={(1cm,0)},y={(0.55cm,0.40cm)},z={(0,1cm)}] \def\L{1.8} % cube side \def\H{1.2} % total height \def\d{0.8} % total distance \def\N{7} % number of layers \def\t{\H/\N} % layer thickness %\draw[dark water] (0,0,0) -- (\L,0,0) -- (\L,\L,0) -- ( 0,\L,0) -- cycle; \def\layer#1#2#3#4{ \draw[#1] (#2+\L,0,#3) --++ (0,\L,0) --++ (0,0,-#4) --++ (0,-\L,0) -- cycle; \draw[#1] (#2,0,#3) --++ (\L,0,0) --++ (0,0,-#4) --++ (-\L,0,0) -- cycle; \draw[#1] (#2,0,#3) --++ (\L,0,0) --++ (0,\L,0) --++ (-\L,0,0) -- cycle; } \layer{metal}{0}{0}{0.6*\t} \foreach \i [evaluate={\x=(\i-1)*\d/(\N-1); \ya=\i*\H/\N; \yb=(\i-1)*\H/\N;}] in {1,...,\N}{ \layer{water}{\x}{\ya}{\t} } \layer{metal}{\d}{\H+0.6*\t}{0.6*\t} \draw[force] (0.75*\L+\d,0.7*\L,\H+0.3*\t) --++ (1.2,0,0) node[above=1,right=-2] {$\vb{F}_{\parallel}$}; \draw[force,<-] (0.75*\L+\d,0.7*\L,\H+0.3*\t) --++ (0,0,1.2) node[above right] {$\vb{F}_{\perp}$}; \draw[vvec] (\L+\d,0.4*\L,\H-0.5*\t) --++ (1,0,0) node[below=0,right=-1] {$\vb{v}$}; \node at (\d+0.45*\L,0.5*\L,\H+0.6*\t) {$A$}; \draw[->,thick] (-0.1*\L,0,-0.1*\H) --++ (0,0,2*\H) node[above=-1] {$z$}; \draw[->,thick] (-0.1*\L,0,-0.1*\H) --++ (2*\L,0,0) node[above] {$x$}; \draw[->,thick,opacity=0.5] (-0.1*\L,0,-0.1*\H) --++ (0,0.5*\L,0) node[right] {$y$}; \tick{-0.1*\L,0,0}{0} node[left=-1] {0}; \tick{-0.1*\L,0,\H}{0} node[left=-1] {$h$}; \end{tikzpicture} \end{document} I still need to add vector F, the angle arc, and the label. Could someone help me? Thank you.
- How to add "ticks" of combined cell with tabularray package?by Explorer on September 15, 2025 at 4:49 am
I want the combined cells have ticks. That is, My desired sketch is as below: I have consulted that there exists abovepos and belowpos in tblr. But it didn't work as below: \documentclass{article} \usepackage{tabularray} \begin{document} \begin{tblr} { colspec={*{6}{X[c,.5cm]}}, cells={font=\ttfamily}, cell{1-2}{3,5} = {c=2}{c}, cell{3}{1} = {c=6}{c}, hlines, % vlines, vlines={abovepos=-1,belowpos=-1} % not work } + & EXP & LEFT & & RIGHT & \\ + & 0 & UP & & DOWN & \\ CV & & & & & \\ \end{tblr} \end{document} Also, I have tried \UseTblrLibrary{tikz}, but it not so smart, because the position of which should have tick is regular(only for combined cell). Is that possible to automate this process? \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{tikz} \newcommand*\mydrawup[3][magenta]{% \draw[#1] (h#2-|v#3) -- ++(0,.2em); } \newcommand*\mydrawdown[3][cyan]{% \draw[#1] (h#2-|v#3) -- ++(0,-.2em); } \begin{document} \begin{tblrtikzabove} \foreach \x/\y in {1/4,1/6,2/4,2/6,3/2,3/3,3/4,3/5,3/6}{ \mydrawdown{\x}{\y} } \foreach \x/\y in {2/4,2/6,3/4,3/6,4/2,4/3,4/4,4/5,4/6}{ \mydrawup{\x}{\y} } \end{tblrtikzabove}% \begin{tblr} { colspec={*{6}{X[c,.5cm]}}, cells={font=\ttfamily}, cell{1-2}{3,5} = {c=2}{c}, cell{3}{1} = {c=6}{c}, hlines, vlines, % vlines={abovepos=-1,belowpos=-1} % not work } + & EXP & LEFT & & RIGHT & \\ + & 0 & UP & & DOWN & \\ CV & & & & & \\ \end{tblr} \end{document}
- tikz plot missing half of the graphby underflow on September 14, 2025 at 11:21 pm
I want to plot y = x sin(1/x) for x between +/-1. I split the graph into two halves to avoid the singularity at the origin, and I was able to plot the right half but not the left half. Minimal (non)working example: \documentclass{amsart} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[->] (-3.5,0) -- (3.5,0) node[right] {$x$}; \draw[->] (0,-1) -- (0,1.1) node[left] {$y$}; \draw[domain=0.01:1, samples=100, variable=\x] plot ({\x}, { \x * sin ( 1 / \x r)}); \draw[domain=-1:-0.01, samples=100, variable=\x] plot ({\x}, { \x * sin ( 1 / \x r)}); \draw[domain=-1:-0.01, samples=100, variable=\x] plot ({\x}, { \x * sin ( 1/ \x r) } ); \end{tikzpicture} \end{document} Why happened to the left half? Thanks for your help!
- How to auto adjust chart height to ensure minipages are the same height?by Thev on September 14, 2025 at 2:31 pm
I am producing the following output: As you can see, the two tcolorbox are not the same height, because of the footnote text. If I cut off everything from 'aliqua' onwards, the two boxes would now appear to have the same height, giving a harmonious side-by-side look. If it was just one page, I could adjust the chart height (height=7.2cm) to achieve this. In this particular case, reducing it to height=6.9cm would do the trick. However, I am programmatically generating these pages and therefore need it to be automated. Is there a way I can set a dynamic chart height, which increases or decreases such that the two minipages always have the same height? MWE: \documentclass[9pt,twoside]{extarticle} % margins \usepackage[includehead,includefoot]{geometry} \geometry{a4paper, top=2.3cm, bottom=2cm, left=2cm,right=2cm} % fonts \usepackage[sfdefault]{noto} % noto sans base \usepackage[T1]{fontenc} \newcommand{\setfont}[1]{\fontsize{#1}{\fpeval{#1 * 1.2}}\selectfont} % graphs \RequirePackage{tcolorbox} \RequirePackage{setspace} \RequirePackage{tikz} \RequirePackage{pgfplots} \pgfplotsset{compat=1.18} \pgfplotsset{/pgf/number format/assume math mode=true} % custom colours \definecolor{header}{HTML}{002f5f} \definecolor{charti}{HTML}{002f5f} \definecolor{chartii}{HTML}{e6af68} \begin{document} \setlength{\parindent}{0pt} \bfseries \begin{center} \color{header} \setfont{21} Page Title \\ \vspace*{-0.2in} \centerline{\rule{1.00\linewidth}{.2pt}} \setfont{17} Page Subtitle \end{center} \vspace*{0.14in} \setfont{12} \linespread{1.15} \begin{center} CHART TITLE\\[0.07in] \end{center} \normalsize \vspace*{0.14in} \begin{minipage}[9cm]{0.22\linewidth} \begin{tcolorbox}[colback=white, colframe=black, boxrule=0.45pt, width=\linewidth, boxsep=10pt,left=2pt,right=2pt,top=2pt,bottom=2pt] \begin{spacing}{1.5} \vspace*{0.2in} \textcolor{charti}{\textbf{• SECTION 1}}\\ \phantom{\textbf{• }}\textbf{RM5,200,000,000} {\color{gray!40!white}\rule{\linewidth}{0.4pt}} \textcolor{chartii}{\textbf{• SECTION 2}}\\[0.07in] \phantom{\textbf{• }}Subsection 1\\ \phantom{\textbf{• }}\textbf{RM5,800,000,000}\\[0.07in] \phantom{\textbf{• }}Subsection 2\\ \phantom{\textbf{• }}\textbf{0} {\color{gray!40!white}\rule{\linewidth}{0.4pt}} \phantom{\textbf{• }}\textbf{TOTAL}\\ \phantom{\textbf{• }}\textbf{RM11,000,000,000} \end{spacing} \end{tcolorbox} \end{minipage}% \begin{minipage}{0.02\linewidth} \phantom{a} \end{minipage} \begin{minipage}{0.76\linewidth} \begin{tcolorbox}[colback=white, colframe=black, boxrule=0.45pt, width=\linewidth, left=6pt,right=6pt,top=10pt,bottom=10pt] \begin{tikzpicture} \centering \small \begin{axis}[ name=plot1, ybar, axis on top, height=6.9cm, width=12.5cm, bar width=0.9cm, bar shift=-0.45cm, enlarge y limits={value=.02,upper}, enlarge x limits=0.15, ymin=0, ymax=7500, axis y line*=left, axis x line*=bottom, y axis line style={opacity=100,color=gray!70!white}, x axis line style={opacity=100,color=gray!70!white}, tickwidth=0pt, ylabel={MILLIONS}, xlabel={YEAR}, ylabel style={rotate=-90,at={(axis description cs:0,1)},yshift=10pt,xshift=6pt}, symbolic x coords={2022,2023*,2024,2025,2026}, xtick=data, nodes near coords={ \rotatebox{0}{ \pgfmathprintnumber[precision=0]{\pgfplotspointmeta}} }, yticklabel style={ /pgf/number format/fixed, /pgf/number format/precision=0 }, scaled y ticks=false ] \addplot [draw=none, fill=charti] coordinates { (2022,4500) (2023*,4300) (2024,4100) (2025,5200) (2026,5200) }; \end{axis} \begin{axis}[ ybar, axis on top, at={(plot1.south west)}, ytick=\empty, height=6.9cm, width=12.5cm, bar width=0.9cm, bar shift=0.45cm, enlarge y limits={value=.02,upper}, enlarge x limits=0.15, ymin=0, ymax=7500, axis y line*=left, axis x line*=bottom, y axis line style={opacity=0}, x axis line style={opacity=0}, tickwidth=0pt, ylabel={}, xlabel={}, ylabel style={rotate=-90,at={(axis description cs:0,1)}, yshift=10pt,xshift=6pt}, symbolic x coords={2022,2023*,2024,2025,2026}, xticklabels=\empty, xtick=data, nodes near coords={ \rotatebox{0}{ \pgfmathprintnumber[precision=0]{\pgfplotspointmeta}} }, yticklabel style={ /pgf/number format/fixed, /pgf/number format/precision=0 }, scaled y ticks=false ] \addplot [draw=none,fill=chartii] coordinates { (2022,6200) (2023*,6900) (2024,6700) (2025,5800) (2026,5800) }; \end{axis} \end{tikzpicture} \vspace*{0.1cm} \normalfont \setfont{6.1} * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat \end{tcolorbox} \end{minipage} \end{document}
- 3D plot "hide axis" produces spurious spaceby adn on September 14, 2025 at 11:34 am
Setup I'm following the answer about parameterized curves in a sphere from https://tex.stackexchange.com/a/199715/7561. I'm inserting these spheres in a bigger diagram and noticed the extra space around the axis plots. I was under the impression that hide axis inside the axis environment should remove all the extra white space around the ticks and axis labels, but it doesn't seem the case. See the extra space in the output image below. Question What am I doing wrong? I think that the culprit may be the disabledatascaling which I still need if I want to insert the spheres and their plots next to another nodes, don't I? MWE \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{ calc, positioning, } \usepgfplotslibrary{ colorbrewer, } \pgfplotsset{compat=1.18, cycle list/Dark2, } % sphere stuff: https://tex.stackexchange.com/a/199715/7561 % Declare nice sphere shading: http://tex.stackexchange.com/a/54239/12440 \pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{0bp}{0bp}}{% color(0bp)=(tikz@ball!0!white); color(7bp)=(tikz@ball!0!white); color(15bp)=(tikz@ball!70!black); color(20bp)=(black!70); color(30bp)=(black!70)} \makeatother % Style to set TikZ camera angle, like PGFPlots `view` \tikzset{viewport/.style n args={3}{ x={({cos(-#1)*#3},{sin(-#1)*sin(#2)*#3})}, y={({-sin(-#1)*#3},{cos(-#1)*sin(#2)*#3})}, z={(0,{cos(#2)*#3})} }} % Styles to plot only points that are before or behind the sphere. \pgfplotsset{only foreground/.style={ restrict expr to domain={rawx*\CameraX + rawy*\CameraY + rawz*\CameraZ}{-0.05:100}, }} \pgfplotsset{only background/.style={ restrict expr to domain={rawx*\CameraX + rawy*\CameraY + rawz*\CameraZ}{-100:0.05} }} % Automatically plot transparent lines in background and solid lines in foreground \def\addFGBGplot[#1]#2;{% \addplot3[#1,only background, opacity=0.25] #2;% \addplot3[#1,only foreground] #2;% } \newcommand{\ViewAzimuth}{-30} \newcommand{\ViewElevation}{30} \begin{document} \begin{tikzpicture} \def\radius{2.5cm} \pgfmathsetmacro{\diameter}{2*\radius} % Compute camera unit vector for calculating depth \pgfmathsetmacro{\CameraX}{sin(\ViewAzimuth)*cos(\ViewElevation)} \pgfmathsetmacro{\CameraY}{-cos(\ViewAzimuth)*cos(\ViewElevation)} \pgfmathsetmacro{\CameraZ}{sin(\ViewElevation)} \begin{scope}[] \node[fill=Dark2-C!35, circle, minimum size=\diameter, outer sep=0pt] (ps) {}; \clip (ps.center) circle (\radius); % tweak the shift to move the ellipse that simulates the lighting \begin{scope}[transform canvas={rotate around={45:(ps.center)}, shift={(-5pt,15pt)}}] \shade [ball color=white, fill opacity=0.5] (ps.center) ellipse ({1.9*\radius} and {1.5*\radius}); \end{scope} \end{scope} \begin{axis}[ name=ps-axis, at={(ps.center)}, view={\ViewAzimuth}{\ViewElevation}, % Set view angle disabledatascaling, % Align PGFPlots coordinates with TikZ anchor=origin, % Align PGFPlots coordinates with TikZ viewport={\ViewAzimuth}{\ViewElevation}{\radius}, % Align PGFPlots coordinates with TikZ hide axis,% this is not working completely ] % Plot equator and two longitude lines with occlusion \addFGBGplot[domain=0:2*pi, samples=100, samples y=1, dashed, Dark2-C!75] ({cos(deg(x))}, {sin(deg(x))}, 0); \end{axis} % there is this spurious space that hid axis is not removing \draw[red] (ps-axis.north west) rectangle (ps-axis.south east); \draw[orange] (ps.north west) rectangle (ps.south east); \end{tikzpicture} \end{document}
- TCBListing overlay: testing whether segmentation nodes have been definedby Grass on September 13, 2025 at 3:40 pm
We can define a command \long\def\ifnodedefinednTF#1#2#3{% \@ifundefined{pgf@sh@ns@#1}{#3}{#2}% } to check whether a TikZ node is defined, and execute code accordingly. This MWE works as intended: \documentclass{article} \usepackage{tikz} \makeatletter \long\def\ifnodedefined#1#2#3{% \@ifundefined{pgf@sh@ns@#1}{#3}{#2}% } \makeatother \begin{document} \begin{tikzpicture} \node (A) at (0,0) {Node A}; \node (B) at (5,0) {Node B}; \ifnodedefined{A}{ \draw (A) circle (1cm); }{ \draw (B) circle (1cm); } \end{tikzpicture} \end{document} producing The same cannot be said when we, instead, use a tcblisting: \documentclass{book} \usepackage[skins, minted]{tcolorbox} % Test whether a TikZ node is defined or not % Source: https://tex.stackexchange.com/a/85531/383565 \makeatletter \long\def\ifnodedefinednTF#1#2#3{% \@ifundefined{pgf@sh@ns@#1}{#3}{#2}% } \makeatother \newtcblisting{foo}{ skin = enhanced, overlay={% \ifnodedefinednTF{segmentation.north west}{ \path[draw=green,fill=green!25] (segmentation.south west) rectangle (segmentation.north east); }{ \path[draw=red,fill=red!25] (frame.south west) rectangle (frame.north east); } }, } \begin{document} \begin{foo} Hello \end{foo} \end{document} produces What we expect is Anyone knows why?
- Drawing an ellipse and a parabola as intersection of a plane with a cone [closed]by Lorenzo Iorio Dr PhD on September 13, 2025 at 9:39 am
I much liked this picture showing a hyperbola obtained as the intersection of a plane with a cone by Juan Castano. I wish to modify the code to obtain a parabola and an ellipse; I wish to keep the same overall style. Thank you in advance for your kind help.
- How to draw cuboids in LaTeX easilyby user110391 on September 12, 2025 at 4:59 am
I've just started familiarizing myself with tikz, and I've only sticked to 2D shapes. Now, I need to draw the following photo in LaTeX: Not like an exact replica of course, but the same idea. Doing this with 2D coordinates would be a pain, and I know you can work with packages and stuff that just allows you to define shapes based on 3D coordinates, and the package does the rest. But I don't know what package this is, and how to use it. What is the simplest way for me to draw cuboids in LaTeX?
- How can I draw a simple three dimensional coil?by Desiree on September 10, 2025 at 10:46 am
I would like to draw something like this using tikz: So far, I only managed this: using the following code: \documentclass[tikz]{standalone} %\usetikzlibrary{decorations} \usetikzlibrary{decorations.pathmorphing} \begin{document} \begin{tikzpicture} \draw[thick,decoration={aspect=0.3, segment length=3mm,amplitude=1cm,coil},decorate] (0,3) -- (0,0.15); \draw[thick] plot[smooth , tension=2] coordinates {(0,3) (-2.5,1.5) (0,0.15)}; \end{tikzpicture} \end{document} Is there a simple way to add the white gaps so that the coil looks three dimensional? Thanks in advance for your help!
- Plotting a cylinder, and a plane and their intersectionby latex_is_pain on June 10, 2025 at 1:36 pm
Hello great Tex experts. I want to draw the following plot(from desmos) which is a cylinder, a plane and their intersection. And here is my code: \begin{tikzpicture} \begin{axis}[ view={47}{47}, axis lines=center, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, xmin=-3, xmax=3, ymin=-3, ymax=3, zmin=-2, zmax=6, legend style={font=\scriptsize}, axis line style={gray!50!black}, tick style={gray!50!black}, tick label style={gray!50!black}, label style={font=\tiny,color=gray!50}, set layers ] % plane \addplot3[surf, % domain=-2:2, domain y=-2:2, opacity=1, colormap/gray,fill=violet] {4 - x}; \addlegendentry{$z+x=4$} % cylinder \addplot3[surf, % domain y=-2:6, domain=0:360, opacity=0.5, colormap/greenyellow,fill=yellow!70] ({sqrt(2)*cos(x)}, {sqrt(2)*sin(x)}, {y}); \addlegendentry{$x^2+y^2=2$} % ellipse \addplot3[thick, blue, domain=0:360,smooth] ({sqrt(2)*cos(x)}, {sqrt(2)*sin(x)}, {4-sqrt(2)*cos(x)}); \addlegendentry{$f(t)$} \end{axis} \end{tikzpicture} And the result: Notice the lower part (below the ellipse) of the cylinder is drawn which is the problem. How to fix that? Also if I reorder the plot commands to draw the cylinder, then plane, then the result will have the plane only (cylinder won't be drawn). Thank you for your time and consideration.
- Border around any general figure?by First User on March 8, 2021 at 10:29 am
Is there is any general command to put a border around any "figure" (pictures, tables, tikz diagrams). In my case I have a document which uses some images and diagrams made using the circuitikz package. I would like to enclose both of them in borders. I have referred to this post which mentions \frame{\includegraphics{image}} but this seems to work only for image files. I was looking for something more general which can be applied to anything that can be considered a figure ie anything that can wrapped in an environment (figure, table, circuitiz, etc). Does such a thing exist ? And if it does, would it be possible to control the thickness of the border ?
- How to fill this ellipse and circleby ryuk on December 16, 2019 at 10:26 pm
I'm trying to fill some region of that figure but it doesn't work. This is my code \documentclass[10pt]{article} \usepackage{pgf,tikz} \usetikzlibrary{arrows} \pagestyle{empty} \begin{document} \definecolor{uuuuuu}{rgb} {0.26666666666666666,0.26666666666666666,0.26666666666666666} \definecolor{cqcqcq}{rgb} {0.7529411764705882,0.7529411764705882,0.7529411764705882} \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm] \draw [color=cqcqcq,dash pattern=on 3pt off 3pt, xstep=1.0cm,ystep=1.0cm] (-7.0,-6.0) grid (7.0,6.0); \draw[->,color=black] (-7.0,0.0) -- (7.0,0.0); \foreach \x in {-7.0,-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0,5.0,6.0} \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$}; \draw[->,color=black] (0.0,-6.0) -- (0.0,6.0); \foreach \y in {-6.0,-5.0,-4.0,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0,5.0} \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$}; \draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$}; \clip(-7.0,-6.0) rectangle (7.0,6.0); \draw [line width=2.0pt] (0.0,0.0) circle (5.0cm); \draw [rotate around={0.0:(0.0,0.0)},line width=2.0pt] (0.0,0.0) ellipse (5.0cm and 2.0cm); \draw [line width=2.0pt] (-0.0,-6.0) -- (-0.0,6.0); \draw [line width=2.0pt,domain=-7.0:7.0] plot(\x,{(-0.0-0.0*\x)/1.0}); \begin{scriptsize} \draw[color=black] (-2.444000566779705,4.000803600484532) node {$c$}; \draw[color=black] (-2.444000566779705,1.4454057992225113) node {$d$}; \draw[color=black] (0.2196768023323968,6.382954093186416) node {$g$}; \draw[color=black] (-8.637591847804593,0.3626101207216553) node {$h$}; \draw [fill=uuuuuu] (-5.0,0.0) circle (1.5pt); \draw[color=uuuuuu] (-4.847806973051602,0.2976423800116039) node {$A$}; \draw [fill=uuuuuu] (-0.0,5.0) circle (1.5pt); \draw[color=uuuuuu] (0.15470906162234555,5.300158414685559) node {$B$}; \draw [fill=uuuuuu] (-0.0,2.0) circle (1.5pt); \draw[color=uuuuuu] (0.15470906162234555,2.3116423420231964) node {$C$}; \draw [fill=uuuuuu] (5.0,0.0) circle (1.5pt); \draw[color=uuuuuu] (5.157225096296292,0.2976423800116039) node {$D$}; \draw [fill=uuuuuu] (0.0,-5.0) circle (2.5pt); \draw[color=uuuuuu] (0.15470906162234555,-4.618250000382282) node {$E$}; \end{scriptsize} \fill[red] (0,2) -- (0,5) -- (5,0) -- cycle; \fill[pink] (0,2) -- (0,5) -- (-5,0) -- cycle; \fill[green] (0,-2) -- (0,-5) -- (5,0) -- cycle; \fill[blue] (0,-2) -- (0,-5) -- (-5,0) -- cycle; \end{tikzpicture} \end{document} Could someone help me?
- Plot surface and normal vector fieldsby user184701 on April 24, 2019 at 1:49 am
I was wondering if there is an easy way to plot a mesh diagram of a surface and also its normal vector field? For example: I wish to plot the sphere $x^2 + y^2 + z^2 = 1$ and the normal vector field at will be all vectors joining (x,y,z) to (2x,2y,2z), where (x,y,z),lies on the sphere.tiks
- Intersection of a sphere and a plane knowing equationsby minhthien_2016 on March 25, 2019 at 1:27 am
I am trying draw a circle is intersection of a plane has equation 2 x − 2 y + z − 15 = 0 and the equation of the sphere is ( x − 1)^2 + ( y + 1)^ 2 + ( z − 2)^ 2 − 25 = 0. The plane cut the sphere is a circle with centre (3,-3,3 and radius r = 4. I can't draw the circle. I tried \documentclass[12pt,border = 2 mm]{standalone} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{arrows,calc,backgrounds} \begin{document} \tdplotsetmaincoords{60}{110} \begin{tikzpicture}[tdplot_main_coords] \path coordinate (T) at (3,-3,3) coordinate (I) at (1,-1,2); \foreach \v/\position in {T/above,I/below} { \draw[fill=black] (\v) circle (0.7pt) node [\position=0.2mm] {$\v$}; } \draw[dashed] (T) circle[radius={4}]; \begin{scope}[tdplot_screen_coords, on background layer] \pgfmathsetmacro{\R}{5}% \fill[ball color=purple, opacity=1.0] (I) circle (\R); \end{scope} \end{tikzpicture} \end{document} How can I draw the circle?
- Zooming in and highlighting parts of a tableby hannes101 on July 17, 2018 at 2:16 pm
I would like to add regression results to a beamer presentation, since it's a vector autoregressive model there are a lot of coefficients. Therefore, I would like to show the whole table just to give an idea on the dimensions and the lags used in the analysis but then I would like to only highlight certain parts of the table, i.e. certain coefficients. There is the possibility to use framezoom, but this does have the disadvantage, that it does more than zooming in on the box, but shows all that fits on the slide, which again clutters the resulting highligh slide. I can fix that by always creating zoomed areas in the same aspect ratio as my presentation, but that's not really satisfactory. Please see beamer framezoom: restrict zoomed frame to border for a description of this problem. Therefore, I would like to know if there's another tool as flexible as tikz and spy to highlight not a certain part of a picture, but of a table. Zooming in and highlighting part of picture MWE showing the usage of framezoom, which should be replace with tikz. % !TeX spellcheck = en_US \documentclass[13pt ,aspectratio=43 %,handout ]{beamer} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage{amsmath,amsfonts,amssymb} \usepackage{gensymb} \usepackage{color} \usepackage{lmodern} %\renewcommand{\rmdefault}{lmss} \usepackage{hyperref} %Remove indentation in footnotes %\usepackage[hang,flushmargin]{footmisc} %Table Packages \usepackage{tabularx} \usepackage{longtable,booktabs,tabu} \usepackage{makecell} \usepackage[detect-all]{siunitx} \sisetup{input-symbols = ()} % "(" and ")" are ordinary inputs \usepackage{setspace} \def\V#1,#2/#3/{\Entry[#3]{#1}{#2}} \usepackage{siunitx} %align numbers by decimal point \usepackage{csquotes} % Options for captions \usepackage[hypcap,format = plain, justification=raggedright, singlelinecheck=off]{caption} \captionsetup[table]{belowskip=0em,aboveskip=2pt} \captionsetup[figure]{belowskip=0em,aboveskip=2pt} \usepackage{textcomp,ragged2e} \usepackage{appendixnumberbeamer} %Turn on and of the display of the notes by commenting out the following line %\setbeameroption{show notes} \setbeamertemplate{note page}[plain] \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{positioning} % % % Theme %\usetheme{Frankfurt} \usetheme[titleformat = regular , sectionpage = progressbar , subsectionpage = none , numbering = counter %none,counter, fraction , progressbar = foot % none, head, frametitle, foot ]{metropolis} \usepackage{standalone} \usepackage{tikz} % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % \begin{document} \setstretch{1,5} \begin{frame}[shrink = 0.2] \frametitle{Distribution of Leverage prior to Price Decline in 2008 and 2014} \framezoom<1><2>[border](2.5cm,1.5cm)(3cm,2cm) \begin{table}[htb] \footnotesize \begin{center} \begin{tabularx}{\textwidth}{>{\centering}p{0.19\textwidth} >{\centering}p{0.01em} >{\centering}X S[table-format=6.0 ,round-mode=places ,round-precision=0 ,table-align-text-post = false ] S[table-format=6.0 ,round-mode=places ,round-precision=0 ,table-align-text-post = false ] >{\centering}p{0.01em} >{\centering}X S[table-format=6.0 ,round-mode=places ,round-precision=0 ,table-align-text-post = false ] S[table-format=6.0 ,round-mode=places ,round-precision=0 ,table-align-text-post = false ] } \toprule Leverage Percentile & & \multicolumn{4}{c}{2008~Q2} & \multicolumn{3}{c}{2014~Q3} \tabularnewline \cmidrule{3-5} \cmidrule{7-9} & & No. & {Assets} & {Debt} & & No. & {Assets} & {Debt}\tabularnewline \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} $1^{st} Quartile$ & & 33 & 3094.25 & 493.08 & & 33 & 5871.65 & 948.29 \tabularnewline % $0 < P_{0.25} \leq 0.25$ $2^{nd} Quartile$ & & 36 & 11868.81 & 2494.08 & & 36 & 12894.65 & 2749.38 \tabularnewline % $0.25 < P_{0.50} \leq 0.50$ $3^{rd} Quartile$ & & 35 & 5018.03 & 1380.06 & & 36 & 4279.47 & 1328.07 \tabularnewline % $0.50 < P_{0.75} \leq 0.75$ $4^{th} Quartile$ & & 35 & 2844.71 & 1208.22 & & 36 & 2001.95 & 884.75 \tabularnewline % $0.75 < P_{1} \leq 1$ Non-calculable Leverage & & 5 & 1172.49 & 338.66 & & 7 & 1304.48 & 390.58 \tabularnewline \bottomrule \end{tabularx} \captionof{table}{Comparison of the number of companies for each leverage group prior to price declines in 2008~Q2 and 2014~Q3 and their average value of total assets and debt in million US-Dollar.}\label{t.Leverage.Groups} \end{center} \end{table} \end{frame} \end{document}
- Wiki engine to embed extensive Tex and PGF/Tikz codeby Tobard on May 18, 2018 at 12:36 pm
I would like to create a wiki (several authors) with scientific content, including text, equations, graphs and schemes. I wish to use LaTeX macros (including my own ones) and draw graphics with the powerful PGF/Tikz syntax. My aim is to minimize the work to turn a .tex file into a wiki page, and to keep code flexibility (ideal case would be to copy/paste raw .tex file content in a wiki page and the server should render it). Is Mediawiki able to do that? Is it possible to approach similar behavior with latex2html? Any feedback would be welcome! Thanks
- How to draw two intersecting cylinders?by kalakay on December 3, 2017 at 12:41 am
By using the TikZ package, I want to draw this: and For the results below, I still need help from GeoGebra. (It's hard for me to draw arcs in slanted position and in shading.) \documentclass[border=10pt]{standalone} \usepackage[x11names,dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{intersections,calc} \begin{document} \begin{tikzpicture}[font=\scriptsize] \coordinate (A) at (0,0); \coordinate (B) at (30:5.4); \coordinate (C) at ($(A)!3cm!-90:(B)$); \coordinate (D) at ($(B)!3cm!90:(A)$); \coordinate (E) at (-20:6); \coordinate (F) at (149:.5); \coordinate (G) at ($(E)!3cm!-90:(F)$); \coordinate (H) at ($(F)!3cm!90:(E)$); \coordinate (K) at ($(A)!.5!(C)$); \coordinate (L) at ($(B)!.5!(D)$); \coordinate (M) at ($(E)!.5!(G)$); \coordinate (N) at ($(F)!.5!(H)$); \path[name path=g1] (A)--(B); \path[name path=g2] (C)--(D); \path[name path=g3] (E)--(F); \path[name path=g4] (G)--(H); \path [name intersections={of = g3 and g1, by={P}}]; \path [name intersections={of = g3 and g2, by={Q}}]; \path [name intersections={of = g4 and g1, by={R}}]; \path[preaction={fill=Emerald,nearly transparent}] (A)--(C)--(D)--(B)--cycle; \path[preaction={fill=Emerald,nearly transparent}] (E)--(F)--(H)--(G)--cycle; %\draw[] (A)--(B) (C)--(D) (E)--(F) (G)--(H); \draw[thick,rotate=-150] let \p1=($(A)-(K)$), \n1={veclen(\x1,\y1)} in (K) circle (1cm and \n1); \draw[thick,rotate=24.5] let \p1=($(B)-(L)$), \n1={veclen(\x1,\y1)} in (D) arc (-79:96:1cm and \n1); \draw[thick,rotate=160] let \p1=($(G)-(M)$), \n1={veclen(\x1,\y1)} in (M) circle (1cm and \n1); \draw[thick,rotate=-15] let \p1=($(F)-(N)$), \n1={veclen(\x1,\y1)} in (F) arc (260:82.5:1cm and \n1); %\foreach \t in {A,B,C,D,E,F,G,H,P,Q,R} %\draw[fill] (\t) node[below] {\t} circle (1.5pt); \end{tikzpicture} \end{document}
- Putting labels on a cube with perspectiveby cheyne on April 4, 2016 at 11:36 pm
I'm trying to draw a cube where the faces are labeled with full perspective. I saw this question but I was looking for more perspective. Any help is greatly appreciated. Below is my attempt: \documentclass[border=5mm,tikz]{standalone} \usepackage{mwe} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[thick](2,2,0)--(0,2,0)--(0,2,2)--(2,2,2)--(2,2,0)--(2,0,0)--(2,0,2)--(0,0,2)--(0,2,2); \draw[thick](2,2,2)--(2,0,2); \draw[gray](2,0,0)--(0,0,0)--(0,2,0); \draw[gray](0,0,0)--(0,0,2); \draw(1,1,2) node{$Mol_{jl}$}; \draw(1,2,1) node{$Mol_{ijkl}$}; \draw(2,1,1) node[rotate=90] {$Mol_{kl}$}; \pgflowlevelscope{\pgftransformxscale{-1}} \draw[gray!20](0.6,1,1) node[rotate=90]{$Mol_{ij}$}; \endpgflowlevelscope ; \pgflowlevelscope{\pgftransformxscale{-1}} \draw[gray!20](-1,1,0) node{$Mol_{ik}$}; \endpgflowlevelscope ; \end{tikzpicture} \end{document}
- How to draw parallelepiped and cube with LaTeXby ryuk on January 2, 2016 at 2:41 pm
How can I draw these solid figures with LaTeX? \begin{tikzpicture} \pgfmathsetmacro{\cubex}{5} \pgfmathsetmacro{\cubey}{1} \pgfmathsetmacro{\cubez}{3} \draw[red,fill=yellow] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle; \draw[red,fill=yellow] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle; \draw[red,fill=yellow] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle; \end{tikzpicture} I have used that code. How can I draw and write the quotes and dimensions?
- How to draw this pyramid with TeX?by minthao_2011 on April 14, 2013 at 2:08 am
I draw this pyramid with GeoSpacw. How to draw this figure with TeX? Where: M is midpoint of the segment SA; I is midpoint of the segment SD; H is project of the point A on the line SO; ABKE is a is a parallelogram; The line passing through S and parallel to the line AB.
- How to draw an Icosahedron?by rtzll on December 31, 2012 at 2:37 pm
After going through the pgf manual and also searching the web for some solution or at least a hint on how it can be done (preferably using TikZ), so I came here with my question: How to draw an Icosahedron? This is what I have in mind: