TikZ
- How to include a white background photo (jpg) in a 10% gray background?by Learner on May 31, 2026 at 11:20 am
I am using \includegraphics{photo.jpg} to upload a photo in a 10% gray background. For 10% gray background INSIDE border \fill[gray!10] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); To upload the photo (with white background, I used \node at ($(current page.south)+( 6cm,5.2cm)$) { \includegraphics{sig_digital.jpg} }; This produced the following photo: We can see the background is not matching, the photo has white background. I have one option, I can make the background to be white. But I want to keep the background gray while adjust the photo background. Edit: I am adding the full latex code: \documentclass[12pt,reqno]{amsart} %\documentclass [border = .2cm] {standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=newest} \topmargin=0.02cm \textwidth = 17cm \textheight = 23cm \baselineskip=11pt \usepackage{color} \makeatletter \renewcommand*{\@cite}[2]{\fcolorbox{black}{white}{#1\if@tempswa, #2\fi}} %\renewcommand*{\@cite}[2]{\fcolorbox{green}{white}{#1, #2}} \renewcommand*{\@biblabel}[1]{{\fcolorbox{green}{white}{#1}}\hfill} \makeatother \setlength{\oddsidemargin}{0.01 pt} \setlength{\evensidemargin}{0.01 pt} \renewcommand{\baselinestretch}{1.4} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{graphicx} \graphicspath{ } \usetikzlibrary{intersections} \usetikzlibrary{patterns} \usepackage{dsfont} \usepackage{amssymb} \usepackage{relsize} \usepackage{soul} \usepackage{exercise} \usepackage{lipsum} \usepackage{epstopdf} \usepackage{pdflscape} \usepackage{csquotes} \usepackage{wrapfig} \usepackage{accents} \usepackage{adjustbox} \usepackage{tikz-3dplot} \usepackage{caption} \usepackage{subcaption} \usepackage{calligra} \usepackage[colorlinks]{hyperref} \hypersetup{citecolor=black} \newtheorem{fig}{figure}[section] \numberwithin{figure}{section} \newcommand\norm[1]{\left\lVert#1\right\rVert} \theoremstyle{plain} \newtheorem{thm}{Theorem}[section] \newtheorem*{thm*}{Theorem} \newtheorem{lem}[thm]{Lemma} \newtheorem{prop}[thm]{Proposition} \newtheorem{cor}{Corollary}[thm] \theoremstyle{definition} \newtheorem{defn}{Definition}[section] \newtheorem{conj}{Conjecture}[section] \newtheorem{exmp}{Example}[section] \theoremstyle{remark} \newtheorem{rem}{Remark} \newtheorem*{note}{Note} \usepackage{mathtools} \makeatletter \@namedef{subjclassname@2020}{% \textup{2020} Mathematics Subject Classification} \makeatother \renewcommand\ExerciseName{Question~} \renewcommand\ExerciseHeader{% \noindent\parbox[t]{.18\textwidth}{% \bfseries\large\ExerciseName\ExerciseHeaderNB\hfill}% \parbox[t]{.72\textwidth}{% \centering\bfseries\large% \ExerciseHeaderTitle\ExerciseHeaderOrigin}% \par\medskip } \newcommand{\md}[1]{\hfill\makebox[0pt][r]{[#1]}} %md=mark distribution \begin{document} \thispagestyle{empty} \begin{tikzpicture}[remember picture,overlay] % Light gray background INSIDE border \fill[gray!10] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); % Border \draw[line width=3pt] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); \draw[line width=1pt] ($(current page.north west) + (1.2cm,-1.2cm)$) rectangle ($(current page.south east) + (-1.2cm,1.2cm)$); % Title % Title (no node name needed) \node at ($(current page.north)+(0,-2.5cm)$) { {\Huge \bfseries Certificate of Presentation} }; % Main underline \draw[line width=1.3pt, color=blue] ($(current page.north)+(-4.7cm,-3.35cm)$) -- ($(current page.north)+(4.7cm,-3.35cm)$); % End dots \fill[color=blue] ($(current page.north)+(-4.9cm,-3.35cm)$) circle (2.2pt); \fill[color=blue] ($(current page.north)+(4.9cm,-3.35cm)$) circle (2.2pt); % Left stem \draw[line width=0.7pt, color=blue] ($(current page.north)+(-5.05cm,-3.35cm)$) -- ($(current page.north)+(-5.22cm,-3.35cm)$); % Left upper leaf \draw[line width=0.7pt, color=blue] ($(current page.north)+(-5.22cm,-3.35cm)$) .. controls +(-0.14,0.14) and +(0.14,0.11) .. ($(current page.north)+(-5.72cm,-3.16cm)$) .. controls +(-0.14,-0.11) and +(-0.10,0.00) .. ($(current page.north)+(-5.22cm,-3.35cm)$); % Left lower leaf \draw[line width=0.7pt, color=green] ($(current page.north)+(-5.22cm,-3.35cm)$) .. controls +(-0.14,-0.14) and +(0.14,-0.11) .. ($(current page.north)+(-5.72cm,-3.54cm)$) .. controls +(-0.14,0.11) and +(-0.10,0.00) .. ($(current page.north)+(-5.22cm,-3.35cm)$); % Right stem \draw[line width=0.7pt, color=blue] ($(current page.north)+(5.05cm,-3.35cm)$) -- ($(current page.north)+(5.22cm,-3.35cm)$); % Right upper leaf \draw[line width=0.7pt, color=blue] ($(current page.north)+(5.22cm,-3.35cm)$) .. controls +(0.14,0.14) and +(-0.14,0.11) .. ($(current page.north)+(5.72cm,-3.16cm)$) .. controls +(0.14,-0.11) and +(0.10,0.00) .. ($(current page.north)+(5.22cm,-3.35cm)$); % Right lower leaf \draw[line width=0.7pt, color=green] ($(current page.north)+(5.22cm,-3.35cm)$) .. controls +(0.14,-0.14) and +(-0.14,-0.11) .. ($(current page.north)+(5.72cm,-3.54cm)$) .. controls +(0.14,0.11) and +(0.10,0.00) .. ($(current page.north)+(5.22cm,-3.35cm)$); \node at ($(current page.north west)+(10.7cm,-5.6cm)$) { \includegraphics[width=4cm]{DHU_logo.png} }; % Body Text (for presenters) \node[align=center, text width=21cm] at ($(current page.center)+(0,0.1cm)$) { \large This is to certify that \\[0.5cm] {\LARGE \textbf{Participant Name}} \\[0.3cm] {\large (Affiliated to XYZ University)} \\[0.3cm] has presented a research paper titled \\[0.3cm] {\large \bfseries ``Title of the Research Paper''} \\[0.3cm] at the \\[0.1cm] { \color{blue!60!black}{{ $\mathbb{T}\mathbb{W}\mathbb{O}-$$\mathbb{DAY}$ $\mathbb{WORKSHOP}$ $\mathbb{AND}$ $\mathbb{CONFERENCE}$ $\mathbb{IN}$ $\mathbb{MATHEMATICS}$}\\[0.25cm] $\mathbb{HONORING}$ $\mathbb{SRINIVASA}$ $\mathbb{RAMANUJAN}$}}\\[0.6cm] held at Darjeeling Hills University from 2--3 July 2026.\\[0.4cm] We appreciate his/her valuable contribution to the conference. }; % Signature Lines \node at ($(current page.south)+( 6cm,3.5cm)$) { \begin{tabular}{c} \rule{5cm}{0.4pt}\\ (Organizer Name) \\ Affiliation \end{tabular} }; %add digital signature \node[scale=0.9] at ($(current page.south)+( 6cm,5.2cm)$) { \includegraphics{sig_digital.jpg} }; \end{tikzpicture} \end{document} The output is as follows: Here is the photo link
- Automatically shift arrow heads in TikZ for piecewise defined functions or gapsby CampanIgnis on May 30, 2026 at 7:40 pm
The tip of arrow heads in TikZ usually extends on exactly the specified coordinate, for example in \draw[->] (0,0) -- (1,1);. Is it possible to align the center of the end mark automatically at the specified coordinate? This is useful for plotting piecewise defined functions using * or o as arrow heads such as in https://commons.wikimedia.org/wiki/File:Discontinuity_jump.eps.png. Another way to achieve a similar result is by calculating the coordinates of the points and adding the points manually by \filldraw[fill=white] (1,0.5) circle (0.75pt);. To illustrate what I would like to have: The center of the two circles should be in the middle of the two blue lines of the MWE. It would also be great if we could define certain x-values to set marks at exactly desired points. MWE \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture}[scale=3] \draw[blue!25,line width=4.80pt] (0,-0.25) -- ++(0,1.25) (1,-0.25) -- ++(0,1.25) ; \draw[domain=0:1, smooth, variable=\x, samples=4, *-o] plot ({\x}, {0.55}); \draw[->] (0,0) -- (1,0); \end{tikzpicture} \end{document}
- How to make the double arrow style more like the `single arrow` in `shapes.arrows`?by Explorer on May 29, 2026 at 10:30 am
What I want to replicate originally is something as below: Now my key point is the arrow of the following style, similar to the single arrow shape in shapes.arrows: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta,positioning,shapes.arrows,decorations.markings} \begin{document} \begin{tikzpicture}[ node distance=2cm and 1cm, shrink/.style={shorten >=#1cm,shorten <=#1cm}, myarrow/.style={ shrink=.75,thick,-Stealth, postaction=decorate, decoration={ markings,mark=at position .5 with { \draw[shrink=0,-] (-10pt,-10pt) -- (10pt,10pt); } } }, mysinglearrow/.style={ shape=single arrow,minimum height=1.5cm,inner sep=3pt,draw,line width=1.2pt, } ] \node[draw] (betaII) {AAAAAAAA}; \node[draw] (betaI)[below left=of betaII]{BBBBBBBBB}; \node[draw] (normal)[below right=of betaII]{CCCCCCCCC}; \draw[myarrow] (betaII.west) -- (betaI.north); \draw[myarrow] (normal.north) -- (betaII.east); \draw[myarrow] (betaI) -- (normal); \node[mysinglearrow,rotate=45] at (-1.75,-1.5) {}; \end{tikzpicture} \end{document} However, that is not behave as a "arrow", but a shape. I dislike the syntax: \node[mysinglearrow,rotate=45] at (-1.75,-1.5) {}; Here below is the simplified version, based on the similar solution code here: % Source - https://tex.stackexchange.com/a/662285 \documentclass[tikz,margin=1cm]{standalone} \usetikzlibrary{arrows.meta} \tikzset{ doubleTriangle/.style args={#1 and #2 colored by #3 and #4}{ -Triangle, line width=#1,#3, postaction={ draw, -Triangle,#4, line width=#2, /utils/exec=\pgfmathsetlengthmacro{\doubleTriangleShortenStart}{((#1)-(#2))/2}, /utils/exec=\pgfmathsetlengthmacro{\doubleTriangleShortenEnd}{1.2*(sqrt(3))*((#1)-(#2))}, shorten <=\doubleTriangleShortenStart, shorten >=\doubleTriangleShortenEnd, }, }, } \begin{document} \begin{tikzpicture} \node[draw,below left] at (0,0) {A}; \node[draw,above right] at (5,5) {B}; \draw[doubleTriangle=1cm and 0.7cm colored by black and white] (0,0) -- (5,5); % \draw[doubleTriangle=1cm and 0.7cm colored by black and white,shorten >=.5cm,shorten <=.5cm] (0,0) -- (5,5); \end{tikzpicture} \end{document} which gives: Noted that the arrow's width is not the same. What I was after as an arrow style, is something as below: Any suggestions on how to make more elegant syntax of this arrow style?
- How could make inkscape input path as single path but not filled area?by Explorer on May 28, 2026 at 5:10 am
The question is similar to this classical one. I followed the following instructions with inkscape and svg2tikz: Procedure: import your bitmap image. vectorize it by Inkscape (potrace algorithm). delete bitmap image. adjust document to content. export it by inkscape2tikz extension. Then, export the svg figure with svg2tikz, it give me the following: \documentclass[tikz]{standalone} \begin{document} \def \globalscale {1.000000} \begin{tikzpicture}[y=1cm, x=1cm, yscale=-\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] \path[fill=black] (8.9, 20.3).. controls (8.8, 20.3) and (8.7, 20.2) .. (8.6, 20.2).. controls (8.6, 20.2) and (8.4, 20.2) .. (8.2, 20.2).. controls (8.1, 20.2) and (7.9, 20.1) .. (7.9, 20.1).. controls (7.8, 20.1) and (7.6, 20.0) .. (7.5, 20.0).. controls (7.4, 20.0) and (7.3, 20.0) .. (7.2, 20.0).. controls (7.2, 19.9) and (7.1, 19.9) .. (7.0, 19.9).. controls (6.8, 19.8) and (6.2, 19.5) .. (6.1, 19.5).. controls (6.1, 19.4) and (6.0, 19.4) .. (6.0, 19.4).. controls (5.9, 19.4) and (5.9, 19.3) .. (5.8, 19.3).. controls (5.8, 19.3) and (5.8, 19.3) .. (5.7, 19.2).. controls (5.7, 19.2) and (5.6, 19.2) .. (5.5, 19.1).. controls (5.4, 19.0) and (5.3, 19.0) .. (5.3, 18.9).. controls (5.1, 18.8) and (4.3, 18.1) .. (4.2, 18.0).. controls (4.2, 18.0) and (4.1, 17.9) .. (4.0, 17.8).. controls (3.9, 17.8) and (3.8, 17.6) .. (3.7, 17.6).. controls (3.6, 17.5) and (3.4, 17.3) .. (3.3, 17.2).. controls (2.7, 16.6) and (2.2, 16.1) .. (1.8, 15.5).. controls (1.7, 15.5) and (1.7, 15.4) .. (1.7, 15.3).. controls (1.6, 15.3) and (1.6, 15.2) .. (1.6, 15.2).. controls (1.5, 15.2) and (1.3, 14.6) .. (1.3, 14.4).. controls (1.3, 14.4) and (1.3, 14.3) .. (1.3, 14.2).. controls (1.2, 14.1) and (1.2, 13.9) .. (1.2, 13.7).. controls (1.2, 13.6) and (1.1, 13.3) .. (1.1, 13.2).. controls (1.1, 13.0) and (1.0, 12.7) .. (1.0, 12.3).. controls (1.0, 12.0) and (1.0, 11.7) .. (1.0, 11.6).. controls (0.9, 10.9) and (1.0, 9.6) .. (1.1, 9.3).. controls (1.1, 9.2) and (1.2, 9.1) .. (1.2, 8.9).. controls (1.2, 8.8) and (1.3, 8.7) .. (1.3, 8.6).. controls (1.3, 8.6) and (1.3, 8.5) .. (1.3, 8.4).. controls (1.4, 8.3) and (1.4, 8.3) .. (1.4, 8.2).. controls (1.4, 8.2) and (1.5, 8.1) .. (1.5, 8.0).. controls (1.5, 7.9) and (1.6, 7.8) .. (1.6, 7.8).. controls (1.6, 7.8) and (1.7, 7.7) .. (1.7, 7.7).. controls (1.7, 7.7) and (1.8, 7.4) .. (1.9, 7.3).. controls (1.9, 7.3) and (2.0, 7.2) .. (2.0, 7.1).. controls (2.1, 7.0) and (2.1, 6.9) .. (2.3, 6.8).. controls (2.4, 6.6) and (2.7, 6.2) .. (2.7, 6.2).. controls (2.8, 6.1) and (2.8, 6.1) .. (2.8, 6.1).. controls (2.8, 6.1) and (3.0, 5.8) .. (3.0, 5.7).. controls (3.1, 5.7) and (3.1, 5.6) .. (3.2, 5.5).. controls (3.3, 5.4) and (3.3, 5.4) .. (3.6, 5.0).. controls (3.7, 4.9) and (3.8, 4.7) .. (3.9, 4.6).. controls (4.0, 4.5) and (4.2, 4.4) .. (4.2, 4.3).. controls (4.4, 4.0) and (4.9, 3.5) .. (5.4, 3.1).. controls (5.5, 3.0) and (5.7, 2.9) .. (5.7, 2.8).. controls (5.9, 2.7) and (6.0, 2.6) .. (6.2, 2.5).. controls (6.2, 2.5) and (6.3, 2.4) .. (6.3, 2.4).. controls (6.3, 2.4) and (6.6, 2.2) .. (6.7, 2.2).. controls (6.7, 2.2) and (6.8, 2.1) .. (6.8, 2.1).. controls (6.8, 2.1) and (6.9, 2.1) .. (7.0, 2.0).. controls (7.1, 2.0) and (7.2, 2.0) .. (7.2, 1.9).. controls (7.3, 1.9) and (7.3, 1.9) .. (7.4, 1.9).. controls (7.4, 1.8) and (7.5, 1.8) .. (7.6, 1.8).. controls (7.6, 1.7) and (7.7, 1.7) .. (7.7, 1.7).. controls (7.7, 1.7) and (7.8, 1.7) .. (7.9, 1.6).. controls (8.0, 1.6) and (8.1, 1.6) .. (8.2, 1.5).. controls (8.3, 1.5) and (8.4, 1.5) .. (8.4, 1.5).. controls (8.4, 1.4) and (8.6, 1.4) .. (8.7, 1.4).. controls (8.9, 1.4) and (9.1, 1.3) .. (9.2, 1.3).. controls (9.3, 1.3) and (9.5, 1.2) .. (9.8, 1.2).. controls (10.0, 1.2) and (10.3, 1.2) .. (10.5, 1.1).. controls (10.8, 1.1) and (11.6, 1.1) .. (12.0, 1.1).. controls (12.2, 1.2) and (12.4, 1.2) .. (12.5, 1.2).. controls (12.6, 1.2) and (12.7, 1.3) .. (12.8, 1.3).. controls (12.8, 1.3) and (12.9, 1.4) .. (13.0, 1.4).. controls (13.1, 1.4) and (13.2, 1.4) .. (13.3, 1.5).. controls (13.3, 1.5) and (13.4, 1.5) .. (13.5, 1.5).. controls (13.6, 1.6) and (13.7, 1.6) .. (13.8, 1.6).. controls (13.8, 1.7) and (13.9, 1.7) .. (14.0, 1.8).. controls (14.4, 1.9) and (14.7, 2.1) .. (14.7, 2.1).. controls (14.7, 2.1) and (14.8, 2.2) .. (14.8, 2.2).. controls (14.9, 2.2) and (15.1, 2.4) .. (15.4, 2.6).. controls (15.6, 2.8) and (16.3, 3.6) .. (16.4, 3.7).. controls (16.5, 3.8) and (16.5, 3.9) .. (16.6, 3.9).. controls (16.7, 4.0) and (16.8, 4.1) .. (16.8, 4.2).. controls (16.8, 4.2) and (16.9, 4.3) .. (16.9, 4.3).. controls (16.9, 4.3) and (16.9, 4.3) .. (16.9, 4.3).. controls (16.9, 4.4) and (17.0, 4.5) .. (17.1, 4.6).. controls (17.1, 4.6) and (17.2, 4.8) .. (17.2, 4.8).. controls (17.3, 4.9) and (17.3, 5.0) .. (17.4, 5.1).. controls (17.5, 5.3) and (17.8, 5.9) .. (17.9, 6.0).. controls (17.9, 6.1) and (17.9, 6.2) .. (18.0, 6.3).. controls (18.0, 6.4) and (18.0, 6.4) .. (18.0, 6.5).. controls (18.0, 6.5) and (18.1, 6.6) .. (18.1, 6.8).. controls (18.2, 6.9) and (18.2, 7.0) .. (18.2, 7.1).. controls (18.2, 7.2) and (18.3, 7.3) .. (18.3, 7.3).. controls (18.3, 7.4) and (18.3, 7.5) .. (18.4, 7.6).. controls (18.4, 7.7) and (18.4, 7.9) .. (18.4, 8.0).. controls (18.6, 8.4) and (18.6, 10.2) .. (18.5, 10.9).. controls (18.4, 11.3) and (18.4, 11.5) .. (18.4, 12.2).. controls (18.3, 12.5) and (18.3, 12.9) .. (18.3, 13.1).. controls (18.3, 13.3) and (18.2, 13.6) .. (18.2, 13.7).. controls (18.2, 13.9) and (18.2, 14.1) .. (18.1, 14.2).. controls (18.1, 14.4) and (18.1, 14.5) .. (18.1, 14.6).. controls (18.0, 14.7) and (18.0, 14.8) .. (18.0, 14.9).. controls (17.9, 15.0) and (17.9, 15.1) .. (17.9, 15.2).. controls (17.9, 15.3) and (17.8, 15.4) .. (17.8, 15.5).. controls (17.8, 15.5) and (17.7, 15.6) .. (17.7, 15.6).. controls (17.7, 15.7) and (17.7, 15.8) .. (17.7, 15.8).. controls (17.6, 15.9) and (17.6, 16.0) .. (17.6, 16.0).. controls (17.6, 16.1) and (17.5, 16.2) .. (17.5, 16.2).. controls (17.5, 16.2) and (17.4, 16.3) .. (17.4, 16.4).. controls (17.4, 16.5) and (17.3, 16.6) .. (17.3, 16.6).. controls (17.3, 16.7) and (17.2, 16.7) .. (17.2, 16.8).. controls (17.2, 16.8) and (17.2, 16.9) .. (17.2, 16.9).. controls (17.1, 17.0) and (17.0, 17.1) .. (17.0, 17.2).. controls (16.9, 17.3) and (16.8, 17.4) .. (16.8, 17.4).. controls (16.8, 17.4) and (16.8, 17.5) .. (16.7, 17.6).. controls (16.6, 17.7) and (16.1, 18.2) .. (16.1, 18.2).. controls (16.0, 18.2) and (16.0, 18.3) .. (15.9, 18.3).. controls (15.9, 18.4) and (15.8, 18.4) .. (15.8, 18.4).. controls (15.7, 18.5) and (15.7, 18.5) .. (15.6, 18.5).. controls (15.6, 18.5) and (15.6, 18.6) .. (15.5, 18.6).. controls (15.5, 18.6) and (15.4, 18.7) .. (15.4, 18.7).. controls (15.4, 18.7) and (15.3, 18.8) .. (15.1, 18.8).. controls (15.0, 18.9) and (14.9, 18.9) .. (14.8, 19.0).. controls (14.6, 19.0) and (14.5, 19.1) .. (14.5, 19.1).. controls (14.5, 19.1) and (14.4, 19.1) .. (14.3, 19.2).. controls (14.3, 19.2) and (14.2, 19.2) .. (14.2, 19.2).. controls (14.1, 19.2) and (14.1, 19.3) .. (14.0, 19.3).. controls (13.9, 19.3) and (13.8, 19.4) .. (13.7, 19.4).. controls (13.6, 19.4) and (13.6, 19.4) .. (13.5, 19.5).. controls (13.5, 19.5) and (13.4, 19.5) .. (13.3, 19.5).. controls (13.3, 19.6) and (13.2, 19.6) .. (13.1, 19.6).. controls (13.1, 19.6) and (13.0, 19.7) .. (12.8, 19.7).. controls (12.7, 19.7) and (12.6, 19.8) .. (12.5, 19.8).. controls (12.1, 19.9) and (11.9, 20.0) .. (11.7, 20.0).. controls (11.6, 20.0) and (11.5, 20.1) .. (11.4, 20.1).. controls (11.3, 20.1) and (11.2, 20.2) .. (10.9, 20.2).. controls (10.7, 20.2) and (10.4, 20.2) .. (10.2, 20.3).. controls (10.0, 20.3) and (9.3, 20.3) .. (8.9, 20.3) -- cycle(10.4, 20.0).. controls (10.6, 19.9) and (10.8, 19.9) .. (10.9, 19.9).. controls (11.0, 19.9) and (11.2, 19.8) .. (11.3, 19.8).. controls (11.4, 19.8) and (11.6, 19.8) .. (11.7, 19.7).. controls (11.7, 19.7) and (11.9, 19.7) .. (12.0, 19.7).. controls (12.1, 19.7) and (12.2, 19.6) .. (12.3, 19.6).. controls (12.4, 19.5) and (12.5, 19.5) .. (12.6, 19.5).. controls (12.7, 19.5) and (12.8, 19.4) .. (12.8, 19.4).. controls (12.9, 19.4) and (13.0, 19.3) .. (13.1, 19.3).. controls (13.2, 19.3) and (13.3, 19.3) .. (13.3, 19.2).. controls (13.4, 19.2) and (13.5, 19.2) .. (13.5, 19.2).. controls (13.6, 19.1) and (13.7, 19.1) .. (13.8, 19.1).. controls (13.8, 19.1) and (13.9, 19.0) .. (14.0, 19.0).. controls (14.0, 19.0) and (14.1, 19.0) .. (14.1, 18.9).. controls (14.1, 18.9) and (14.2, 18.9) .. (14.3, 18.9).. controls (14.4, 18.8) and (14.5, 18.8) .. (14.6, 18.8).. controls (14.6, 18.7) and (14.7, 18.7) .. (14.7, 18.7).. controls (14.7, 18.7) and (15.2, 18.5) .. (15.2, 18.4).. controls (15.2, 18.4) and (15.3, 18.4) .. (15.3, 18.4).. controls (15.6, 18.3) and (16.4, 17.6) .. (16.6, 17.2).. controls (16.7, 17.0) and (16.8, 16.9) .. (16.8, 16.9).. controls (16.8, 16.9) and (17.2, 16.2) .. (17.2, 16.2).. controls (17.2, 16.1) and (17.3, 16.0) .. (17.3, 16.0).. controls (17.3, 15.9) and (17.4, 15.8) .. (17.4, 15.8).. controls (17.4, 15.7) and (17.4, 15.7) .. (17.4, 15.6).. controls (17.5, 15.6) and (17.5, 15.5) .. (17.5, 15.4).. controls (17.5, 15.4) and (17.6, 15.2) .. (17.6, 15.1).. controls (17.6, 15.0) and (17.7, 14.9) .. (17.7, 14.8).. controls (17.7, 14.8) and (17.7, 14.6) .. (17.8, 14.5).. controls (17.8, 14.4) and (17.8, 14.3) .. (17.8, 14.3).. controls (17.8, 14.2) and (17.9, 13.9) .. (17.9, 13.7).. controls (18.0, 13.6) and (18.0, 13.3) .. (18.0, 12.8).. controls (18.0, 12.5) and (18.1, 12.1) .. (18.1, 12.0).. controls (18.1, 11.9) and (18.1, 11.7) .. (18.1, 11.4).. controls (18.2, 10.8) and (18.2, 10.1) .. (18.3, 10.0).. controls (18.3, 9.9) and (18.3, 8.8) .. (18.3, 8.7).. controls (18.2, 8.7) and (18.2, 8.5) .. (18.2, 8.2).. controls (18.1, 7.8) and (18.1, 7.5) .. (17.9, 7.2).. controls (17.9, 7.1) and (17.9, 7.0) .. (17.8, 6.9).. controls (17.8, 6.8) and (17.8, 6.7) .. (17.8, 6.6).. controls (17.7, 6.6) and (17.7, 6.5) .. (17.7, 6.4).. controls (17.6, 6.2) and (17.5, 5.9) .. (17.4, 5.7).. controls (17.3, 5.6) and (17.3, 5.4) .. (17.2, 5.3).. controls (17.2, 5.3) and (17.1, 5.1) .. (17.0, 5.1).. controls (17.0, 5.0) and (16.9, 4.9) .. (16.9, 4.8).. controls (16.9, 4.8) and (16.8, 4.7) .. (16.7, 4.6).. controls (16.7, 4.5) and (16.6, 4.4) .. (16.6, 4.4).. controls (16.5, 4.1) and (15.7, 3.3) .. (15.2, 2.9).. controls (14.9, 2.6) and (14.9, 2.6) .. (14.6, 2.4).. controls (14.4, 2.2) and (14.1, 2.1) .. (14.0, 2.1).. controls (14.0, 2.1) and (13.9, 2.0) .. (13.9, 2.0).. controls (13.8, 2.0) and (13.7, 1.9) .. (13.6, 1.9).. controls (13.5, 1.9) and (13.5, 1.8) .. (13.5, 1.8).. controls (13.5, 1.8) and (13.4, 1.8) .. (13.3, 1.8).. controls (13.2, 1.7) and (13.1, 1.7) .. (13.0, 1.7).. controls (13.0, 1.6) and (12.9, 1.6) .. (12.8, 1.6).. controls (12.6, 1.6) and (12.5, 1.5) .. (12.5, 1.5).. controls (12.2, 1.4) and (10.2, 1.4) .. (10.0, 1.5).. controls (10.0, 1.5) and (9.8, 1.5) .. (9.6, 1.5).. controls (9.0, 1.6) and (8.5, 1.7) .. (8.2, 1.8).. controls (8.2, 1.8) and (8.1, 1.9) .. (8.0, 1.9).. controls (8.0, 1.9) and (7.8, 2.0) .. (7.7, 2.0).. controls (7.6, 2.1) and (7.5, 2.1) .. (7.4, 2.2).. controls (6.8, 2.4) and (6.4, 2.7) .. (5.9, 3.1).. controls (5.7, 3.2) and (5.5, 3.4) .. (5.4, 3.5).. controls (5.1, 3.7) and (5.0, 3.9) .. (4.8, 4.1).. controls (4.7, 4.2) and (4.5, 4.4) .. (4.4, 4.5).. controls (4.2, 4.7) and (4.1, 4.8) .. (4.1, 4.8).. controls (4.1, 4.8) and (4.1, 4.9) .. (4.0, 4.9).. controls (4.0, 5.0) and (3.9, 5.1) .. (3.9, 5.1).. controls (3.8, 5.2) and (3.8, 5.3) .. (3.7, 5.3).. controls (3.7, 5.4) and (3.6, 5.4) .. (3.6, 5.5).. controls (3.6, 5.5) and (3.5, 5.6) .. (3.5, 5.7).. controls (3.3, 5.8) and (3.2, 5.9) .. (3.2, 6.0).. controls (3.1, 6.1) and (3.1, 6.1) .. (3.1, 6.2).. controls (3.0, 6.3) and (3.0, 6.3) .. (2.9, 6.4).. controls (2.9, 6.5) and (2.8, 6.5) .. (2.8, 6.6).. controls (2.8, 6.6) and (2.7, 6.7) .. (2.7, 6.7).. controls (2.7, 6.8) and (2.6, 6.8) .. (2.6, 6.9).. controls (2.5, 6.9) and (2.5, 7.0) .. (2.4, 7.1).. controls (2.4, 7.1) and (2.3, 7.2) .. (2.3, 7.3).. controls (2.3, 7.3) and (2.2, 7.4) .. (2.2, 7.4).. controls (2.2, 7.5) and (2.1, 7.5) .. (2.1, 7.5).. controls (2.1, 7.5) and (2.1, 7.6) .. (2.0, 7.7).. controls (2.0, 7.7) and (1.9, 7.9) .. (1.9, 7.9).. controls (1.8, 8.0) and (1.7, 8.2) .. (1.7, 8.2).. controls (1.7, 8.3) and (1.7, 8.4) .. (1.6, 8.5).. controls (1.6, 8.5) and (1.6, 8.7) .. (1.5, 8.8).. controls (1.5, 8.9) and (1.5, 9.0) .. (1.5, 9.1).. controls (1.4, 9.1) and (1.4, 9.3) .. (1.4, 9.4).. controls (1.4, 9.6) and (1.3, 9.8) .. (1.3, 9.9).. controls (1.2, 10.2) and (1.2, 11.6) .. (1.3, 12.2).. controls (1.3, 12.3) and (1.4, 12.6) .. (1.4, 12.8).. controls (1.4, 13.3) and (1.4, 13.5) .. (1.5, 13.7).. controls (1.5, 13.8) and (1.5, 14.0) .. (1.6, 14.1).. controls (1.6, 14.3) and (1.6, 14.4) .. (1.6, 14.5).. controls (1.7, 14.5) and (1.7, 14.6) .. (1.7, 14.7).. controls (1.8, 14.9) and (2.0, 15.3) .. (2.1, 15.5).. controls (2.2, 15.6) and (2.7, 16.2) .. (2.8, 16.3).. controls (2.8, 16.3) and (2.9, 16.4) .. (3.0, 16.5).. controls (3.2, 16.7) and (3.5, 17.0) .. (3.9, 17.3).. controls (4.0, 17.4) and (4.1, 17.5) .. (4.1, 17.5).. controls (4.2, 17.6) and (5.0, 18.3) .. (5.2, 18.5).. controls (5.2, 18.5) and (5.3, 18.6) .. (5.4, 18.6).. controls (5.6, 18.8) and (5.9, 19.0) .. (6.0, 19.0).. controls (6.0, 19.0) and (6.0, 19.1) .. (6.1, 19.1).. controls (6.1, 19.1) and (6.2, 19.2) .. (6.2, 19.2).. controls (6.2, 19.2) and (6.3, 19.2) .. (6.3, 19.2).. controls (6.4, 19.3) and (6.5, 19.3) .. (6.5, 19.3).. controls (6.6, 19.3) and (6.6, 19.4) .. (6.7, 19.4).. controls (6.7, 19.4) and (6.8, 19.5) .. (6.9, 19.5).. controls (6.9, 19.5) and (7.0, 19.5) .. (7.1, 19.6).. controls (7.2, 19.6) and (7.3, 19.6) .. (7.3, 19.7).. controls (7.4, 19.7) and (7.5, 19.7) .. (7.6, 19.7).. controls (7.7, 19.8) and (7.8, 19.8) .. (7.9, 19.8).. controls (8.0, 19.8) and (8.1, 19.9) .. (8.2, 19.9).. controls (8.5, 20.0) and (9.7, 20.0) .. (10.4, 20.0) -- cycle; \end{tikzpicture} \end{document} which give me a filled area, but not a path. I would prefer a path with the same line width in my actual case. Here below is the original blurry image: Says that I want a closed and smooth path, any suggestion on the process above? Edited: I try with Gemini-3.5-Flash with the following prompt: Identify the path and return to me a smooth TikZ Bezier closed curve. Which give the code: \documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture} \draw [ line width=1.5pt, color=black!80, line cap=round, line join=round ] (0.2, 2.2) .. controls (1.0, 2.2) and (1.5, 1.9) .. (1.8, 1.3) .. controls (2.1, 0.7) and (2.2, -0.2) .. (1.9, -0.9) .. controls (1.6, -1.6) and (0.9, -2.1) .. (0.0, -2.1) .. controls (-0.9, -2.1) and (-1.6, -1.7) .. (-2.0, -0.9) .. controls (-2.4, -0.1) and (-2.4, 0.8) .. (-1.8, 1.5) .. controls (-1.2, 2.2) and (-0.6, 2.2) .. (0.2, 2.2) -- cycle; \end{tikzpicture} \end{document} But the details is NOT what the original image is, and the output code is unstable(due to LLM's randomness limitation): The LLM solution is probably not what I was after here.
- Draw balls in Galton boardby Stephen on May 26, 2026 at 9:06 am
I need to draw some balls at the entrance (and if possible at the bottom) of the Galton board like the following picture: Code: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \def\distance{0.3cm} \def\layer{10} \def\radius{2pt} % draw the nails \foreach \i in {0,...,\layer} { \foreach \j in {0,...,\numexpr\i+1\relax} { \draw ({-\distance*\i/2 + \distance*\j}, {-sqrt(3)*\distance*\i/2}) circle[radius=\radius]; } } % draw the slant board on both sides \draw ({-\layer*\distance/2-sqrt(3)*\radius}, {-sqrt(3)*\distance*\layer/2-\radius}) -- (0,2*\radius) -- +(-4pt,4pt); \draw ({-\layer*\distance/2+\distance*(\layer+1)+sqrt(3)*\radius}, {-sqrt(3)*\distance*\layer/2-\radius}) -- (\distance,2*\radius) -- +(4pt,4pt); % draw the separator plates \foreach \i in {0,...,\numexpr\layer+1\relax} { \draw ({-\layer*\distance/2 + \i*\distance}, {-sqrt(3)*\layer*\distance/2 - \radius}) -- ++ (0,-0.5cm); } % draw the bottom line \draw ({-\layer*\distance/2},{-sqrt(3)*\layer*\distance/2 - \radius - 0.5cm}) -- ++ ({(\layer+1)*\distance},0); % number the separated areas \foreach \i in {0,...,\numexpr\layer\relax} { \node at ({-\layer*\distance/2 + \distance*(\i+0.5)},{-sqrt(3)*\layer*\distance/2 - \radius - 0.7cm}) {\footnotesize\i}; } \end{tikzpicture} \end{document}
- How to make 3D axes pass above/below a surface in pgfplotsby UnknownW on May 25, 2026 at 11:54 pm
I am trying to draw a 3D graph that looks like the attached picture. However, I cannot make the axes behave in the same way. In the picture, some intervals of the axes appear on top of the surface, while on other intervals the surface appears above the axes. I would also like the axis labels to stay outside the arrow tips. What I have tried so far is shown below, together with the attached picture. I would like a solution that works for arbitrary functions, not only for this particular example. \documentclass[tikz,border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ view={45}{20}, axis lines=center, %axis on top, axis line style={-latex}, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, ticks=none, xmin=-5, xmax=5, ymin=-5, ymax=5, zmin=-4, zmax=4, width=7cm, height=7cm, colormap/jet, declare function={ f(\x,\y)=10*\y/((\x^2 + 1)*(\y^2 + 2*\y + 4)); }, ] \addplot3[ surf, opacity=0.6, faceted color=black!80, samples=60, samples y=60, domain=-4:4, y domain=-4:4, line width=0.01pt, ] (({x},{y},{f(x,y)}); \end{axis} \end{tikzpicture} \end{document}
- Help sketching the polarity of HCl, H₂O, and CO₂ in LaTeXby Abdelhalim AANIBA on May 24, 2026 at 3:25 pm
I’m trying to create professional-looking molecular polarity diagrams in LaTeX (using TikZ or chemfig if possible). I need help sketching the partial charges cloud distribution for the following molecules: HCl H₂O CO₂ Moved from a non-answer (it's no solution, just problem description), and adding missing lines to make the posted code compile by MS-SPO this is so far my code, but I don't know how to connect all the clouds to give me a similar figure like the image \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} % Source - https://tex.stackexchange.com/a/763072 % Posted by Abdelhalim AANIBA, modified by community. See post 'Timeline' for change history % Retrieved 2026-05-25, License - CC BY-SA 4.0 \begin{tikzpicture}[scale=1.5] % Couleurs pour les nuages de charges \definecolor{negColor}{RGB}{255,100,100} % Rouge pour δ- \definecolor{posColor}{RGB}{100,100,255} % Bleu pour δ+ % Atomes \node[draw, circle, minimum size=0.6cm, fill=gray!30] (O) at (0,0) {O}; \node[draw, circle, minimum size=0.5cm, fill=gray!20] (H1) at (-0.8,-0.6) {H}; \node[draw, circle, minimum size=0.5cm, fill=gray!20] (H2) at (0.8,-0.6) {H}; % Liaisons \draw[thick] (O) -- (H1); \draw[thick] (O) -- (H2); % ===== NUAGE DE CHARGE NÉGATIVE (δ-) autour de l'oxygène ===== % Utilisation d'un shading radial pour un dégradé continu du centre vers l'extérieur \shade[inner color=negColor, outer color=negColor!10, opacity=0.3] (O) circle (0.8cm); % ===== NUAGES DE CHARGE POSITIVE (δ+) autour des hydrogènes ===== \shade[inner color=posColor, outer color=posColor!10, opacity=0.3] (H1) circle (0.5cm); \shade[inner color=posColor, outer color=posColor!10, opacity=0.3] (H2) circle (0.5cm); % Petits symboles δ- et δ+ (optionnels, très discrets) \node[red] at ($(O)+(0.08,1)$) {$2\delta^-$}; \node[blue] at ($(H1)+(0.05,-0.7)$) {$\delta^+$}; \node[blue] at ($(H2)+(0.05,-0.7)$) {$\delta^+$}; \end{tikzpicture} \end{document}
- White halo around black & transparent image in tikzby aky-her on May 24, 2026 at 12:36 pm
I have a png image that contains pure black crosshatching and the rest is fully transparent. I added that to a tikz image, but against a black background, a fine white line is added (see the picture) around the edges of the hatching. Why is the white line there and how can I get rid of it? Is this an issue with the image or with how I am using tikz? edit: here is a link to the file: https://limewire.com/d/47cga#KK6HtC3jAV (I am using an external file sharing site, because pasting the file here as an image actually removed the issue. My problem is solved, but I still don't know what was wrong or how to fix this outside of making an SO question, pasting the image there, downloading a second copy and discarding the question without posting it. At least this confirms that the issue was with the image.) Edit: I am using the default Ubuntu Document Viewer. I also tried several free online pdf viewers, all had the same issue. Here is my code: \documentclass{article} \usepackage[paperheight=8cm, paperwidth=6cm, left=0pt, top=0pt, right=0pt, bottom=0pt]{geometry} \usepackage{tikz} \begin{document} \begin{tikzpicture}[remember picture, overlay, shift = {(current page.south west)}] \node at (current page.center) [] {\includegraphics[height=\paperheight]{example-image-a.png}}; \node at (current page.center) [] {\includegraphics[height=\paperheight, width=\paperwidth]{ims/border_pure_black.png}}; \end{tikzpicture} \end{document}
- How is pos determined for a node on a rectangle path in TikZ?by internet on May 5, 2026 at 3:14 pm
I am trying to understand how TikZ calculates the position of a node when using the pos option on a rectangle path. Here is a minimal example: \documentclass[border=10pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[thin, gray!25] (0,0)--(4,4); \foreach \p in {0.1, 0.3, 0.5, 0.7, 0.9} { \draw (0,0) rectangle (4,4) node[pos=\p, black] {\p}; } \end{tikzpicture} \end{document} From my experiments, it seems that the position is determined along the diagonal of the rectangle rather than along its perimeter. How exactly is pos computed for a rectangle path? Is there a general rule for how pos is defined for different path constructions in TikZ? I checked the TikZ/PGF manual, but the manual doesn’t seem to explain how pos works specifically for the rectangle case.
- How come when filling in TikZ, there is a visible gap between adjacent fills?by Jasper on November 12, 2025 at 1:00 am
How come when filling in TikZ, there is a visible gap between adjacent fills? \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (0,0) -- (1,1) -- (1,0) -- cycle; \fill (0,0) -- (1,1) -- (0,1) -- cycle; \end{tikzpicture} \end{document}
- Clip in tikz-3dplotby Angelo Aliano Filho on March 9, 2025 at 9:34 pm
I have the code below working perfectly: \documentclass[tikz,border=0mm]{standalone} \usepackage{tikz-3dplot} \definecolor{vinho}{rgb}{0.0, 0.26, 0.15} \usepackage{xfp} \newcommand{\ar}[1]{\fpeval{round(#1,2)}} \usetikzlibrary{positioning} \begin{document} \tdplotsetmaincoords{75}{120} \foreach \ang in {45}{ \begin{tikzpicture}[tdplot_main_coords,font=\small] \draw[-latex] (0,0,0) -- (4,0,0) node[below left]{$x$}; \draw[-latex] (0,0,0) -- (0,4,0) node[right]{$y$}; \draw[-latex] (0,0,0) -- (0,0,4) node[above]{$z$}; \draw[dashed] (0,0,0) -- (-4,0,0) (0,0,0) -- (0,-4,0) (0,0,0) -- (0,0,-2.5); \draw[fill,gray,opacity=0.1] (-4,-4,0) -- (-4,4,0) -- (4,4,0) -- (4,-4,0) -- cycle; \foreach \Rmax in {0,0.025,...,0.95,1}{ \draw[opacity=0.15,samples=50,smooth,domain=0:360,vinho,line width=0.7pt] plot({2*sqrt(2)*\Rmax*cos(\x)},{sqrt(2)*\Rmax*sin(\x)},{2-2*\Rmax^2}); } \foreach \Tmax in {0,5,...,360}{ \draw[opacity=0.15,samples=50,smooth,domain=0:1,vinho,line width=0.7pt] plot({2*sqrt(2)*\x*cos(\Tmax)},{sqrt(2)*\x*sin(\Tmax)},{2-2*\x^2}); } % \coordinate (P0) at (1,1,0.75); \coordinate (P1) at ({3*cos(\ang)},{3*sin(\ang)},-0.5); \coordinate (P2) at ({-3*cos(\ang)},{-3*sin(\ang)},-0.5); \coordinate (P3) at ({-3*cos(\ang)},{-3*sin(\ang)},1.5); \coordinate (P4) at ({3*cos(\ang)},{3*sin(\ang)},1.5); \draw[vinho,fill,fill opacity=0.05] (P1) -- (P2) -- (P3) -- (P4) -- cycle; % \draw[-latex,blue,thick] (0,0,0) -- ({1.5*cos(\ang)},{1.5*sin(\ang)},{0}) node[below right] {$\mathbf{u}$}; \draw[-latex,red] (P0) -- +({cos(\ang)},{sin(\ang)},{-0.5*cos(\ang)-2*sin(\ang)}) node[right=-2pt] {$\frac{\partial f}{\partial \mathbf{u}}$}; %Cut the parabola with zmin here..... \draw[black,smooth,domain=-2:2,samples=100,thick] plot({\x},{(-sin(\ang)+cos(\ang)+sin(\ang)*(\x))/cos(\ang)},{2-0.25*(\x)^2 -((-sin(\ang)+cos(\ang)+sin(\ang)*(\x))/cos(\ang))^2}); % \fill (P0) node[above] {\scalebox{0.8}{$P_0$}} circle (2pt); \node[name=funcao,anchor=west] at (1,5,3) {$f(x,y) = 2-\frac{x^2}{4} - y^2$}; \node[name=P,below=1cm of funcao.west,anchor=west] {$P_0=(1,1)$ e $\mathbf{u} = (\cos \ar{\ang}º,\sin \ar{\ang}º)$}; \node[,below=1cm of P.west,anchor=west] {$\frac{\partial f}{\partial \mathbf{u}} (P_0) = \ar{-0.5*cos(\ang*pi/180)-2*sin(\ang*pi/180)}$}; \end{tikzpicture} } \end{document} Whose output is the following: However, I would like to cut the image with a given zmin (for example, cut from zmin=-1). How can I do this with tikz-3dplot. I have tried with clip command but I don't get the desired result.
- Diagnosing Standalone and Gensymb conflictby Altissimo on January 9, 2024 at 5:52 pm
Disclaimer: I am new-ish to LaTeX, and self-taught. I am trying to make a "Unit Circle" TikZ graphic, in which I would like to have the \degree symbol from the gensymb package in the label text of a node. My current workflow involves the standalone package, and uses the \include command to create a sort of "master file" containing each of my creations on its own page which I reference in other Overleaf projects using the 'output file from another project' and the graphicx package to reduce compile time. There is probably a better way to do this, but it keeps it simple enough for me and I like having everything in more or less the same place so I can make quick references between my images. It has worked so far, until now... My problem is, it is preferable if I don't have to update the preamble of my master document every time I add a new picture, especially since that's where I define things like colors which occasionally use identical names (e.g. gradient1). Hence, I load \usepackage[subpreambles]{standalone} to read the preamble of each standalone separately. Again, this has worked well enough so far that I have been able to solve any hiccups myself. I have failed to diagnose why exactly, but there is something going on with the [subpreambles] tag and loading the gensymb package. Here is my MWE: \documentclass[tikz]{standalone} \usepackage{textcomp,gensymb} % for degree symbol \begin{document} \begin{tikzpicture} \node at (0,0) {$0\degree$}; \end{tikzpicture} \end{document} which I have in Overleaf as degree-test.tex. When I try to reference this file in another: \documentclass[tikz]{standalone} \usepackage[subpreambles]{standalone} \begin{document} \include{degree-test} \end{document} I get the error: Package standalone Warning: Sub-preamble of file 'degree-test.tex' has changed. Content will be ignored. Please rerun LaTeX! on input line 4. I compile with LuaLaTeX, but other compilers produce similar results. Even removing \degree from the node label produces the error, despite not actually using the symbol. There must be some kind of conflict with commands which define certain things during the preamble, but I don't know how to read the error logs and they're very frightening on the surface. Is there a simple fix for this? EDIT: I have also disqualified \documentclass[tikz]{standalone} and \include vs \includestandalone as culprits.
- Tikz symbols over colors in tableby David Moldes on November 14, 2023 at 1:53 pm
I am using the tikz package to create checkmarks and crosses, but if I color the rows, then they are only partially seen. Here is a minimal working example: \documentclass[table]{article} \usepackage{graphicx, xcolor} % Required for inserting images \usepackage{tabularx,booktabs} \usepackage{amsmath,amsfonts,amssymb,amscd,amsthm} \usepackage{multirow} \usepackage{array} \usepackage{multicol} \definecolor{DarkGreen}{rgb}{0.0, 0.5, 0.0} \definecolor{DarkRed}{rgb}{0.76, 0.13, 0.28} \definecolor{lavender}{rgb}{0.9, 0.9, 0.98} \usepackage{tikz} \def\checkmark{\color{DarkGreen}\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;} \def\cross{\color{DarkRed}$\mathbin{\tikz [x=1.4ex,y=1.4ex,line width=.2ex, red] \draw (0,0) -- (1,1) (0,1) -- (1,0);}$} \begin{document} \begin{table}[] \begin{tabular}{lccccc} \toprule & \multicolumn{3}{c}{\textbf{Proteins}} & \textbf{CHs} & \multicolumn{1}{l}{} \\ \cline{2-5} \multicolumn{1}{c}{\textbf{DES}} & \textit{BCA Microplate} & \textit{BCA 1 mL} & \textit{Bradford} & \textit{Dubois} & \textit{\textbf{Apt?}} \\ \toprule \rowcolor{lavender} \textit{ChCl:Lactic acid} & -22,6\% & 13,2\% & 15,0\% & 4,3\% & \multirow{2}{*}{\checkmark} \\ \rowcolor{lavender} \textit{ChCl:Lactic acid} & -32,0\% & 6,3\% & -7,5\% & 12,9\% & \\ \textit{ChCl:2Lactic acid} & -43,6\% & 8,3\% & 10,8\% & 11,9\% & \multirow{2}{*}{\checkmark} \\ \textit{ChCl:2Lactic acid} & -46,7\% & -2,0\% & -3,1\% & 20,8\% & \\ \rowcolor{lavender} \textit{ChCl:3Lactic Acid} & -41,7\% & 6,4\% & 5,9\% & 12,9\% & \multirow{2}{*}{\checkmark} \\ \rowcolor{lavender} \textit{ChCl:3Lactic Acid} & -51,1\% & -1,6\% & 3,9\% & 35,1\% & \\ \textit{ChCl:6Lactic Acid} & -57,3\% & -3,3\% & 3,1\% & 42,9\% & \multirow{2}{*}{\cross} \\ \textit{ChCl:6Lactic Acid} & -54,6\% & -1,1\% & 6,4\% & 28,0\% & \\ \bottomrule \end{tabular} \end{table} \end{document}
- Circled inline letters with minimum size to contain each single letter of the a-z alphabetby Enlico on January 22, 2023 at 5:36 pm
This was a very good starting point for the solution below, which is still not perfect for my usecase. I've tried to adapt it to show 3 circled letters with zero or more intervening letter between the circled ones and zero or more letters right out of the first and third circle. In other words, the desired scheme is that I want to type xOxOxOx, where each O represents a single circled possibly different letter, and each x represents a sequence of zero or more letters. The desired result is something like this (the code is below): What I don't like of this solution is that I had to hardcode a 1.3 multiplicative factor for \f@size. Indeed, if I remove *1.3, the size of the circle around m will be bigger than that of the circles around i and j. The 1.6 in the linked answer seemed a bit too much. Here's the MWE verified on David Carlisle's TeXlive.net: \documentclass{article} \usepackage{tikz} \begin{document} \makeatletter \newcommand\stencil[7]{% \tikz[outer sep=0, inner sep=0, baseline=(A.base), anchor=west]{ \node (A) {\vphantom{Wpm}#1}; \node[shape=circle, draw, minimum height={\f@size*1.3}] (B) at (A.east) {\vphantom{Wpm}#2}; \node (C) at (B.east) {\vphantom{Wpm}#3}; \node[shape=circle, draw, minimum height={\f@size*1.3}] (D) at (C.east) {\vphantom{Wpm}#4}; \node (E) at (D.east) {\vphantom{Wpm}#5}; \node[shape=circle, draw, minimum height={\f@size*1.3}] (F) at (E.east) {\vphantom{Wpm}#6}; \node (G) at (F.east) {\vphantom{Wpm}#7}; }% } \makeatother before\stencil{h}{i}{j}{k}{}{m}{}after beforeh before \stencil{h}{i}{j}{k}{}{m}{} after before h \end{document}
- Using tikz spath3 with *nodes*by DimanNe on November 26, 2021 at 8:39 am
I can use spath3 with paths (not nodes) in this way: \documentclass{article} \usepackage{tikz} \usetikzlibrary{spath3, intersections} \begin{document} \begin{tikzpicture} \draw[spath/save = rect, rounded corners=12pt] (0,0) rectangle (2,1); \draw[spath/save global = line3] (-1,-1) -- (0.4,0.75); \draw[spath/save global = line4] (-1,-1) -- (1,0.5); \tikzset{spath/.cd, split at intersections with={rect}{line3}, split at intersections with={rect}{line4}, get components of={rect}\cpts } \draw[ultra thick, color=red, spath/restore=\getComponentOf\cpts{3}] node {}; \end{tikzpicture} \end{document} Result: So far so good. But what I really need is highlight a part of rectangle node in the intersection with a double line, and it does not work: \documentclass{article} \usepackage{tikz} \usetikzlibrary{spath3, intersections} \begin{document} \begin{tikzpicture} \node[spath/save global = rect, rectangle, rounded corners=12pt, draw=black!50, thick, fill=white, minimum height=27pt] {asdfasdfasdfasdf}; \draw[spath/save global = line, line width=1pt, double=white, draw=black!20, double distance=3pt] (-2, -1) -- (-0.5,0.0); \tikzset{spath/.cd, split at intersections with={rect}{line}, split at intersections with={rect}{line}, get components of={rect}\cpts } \draw[ultra thick, color=red, spath/restore=\getComponentOf\cpts{2}] node {}; \end{tikzpicture} \end{document} Any ideas?
- TIKZ Macro for drawing pyramids of circlesby jadou on October 30, 2020 at 12:31 pm
I would like to provide the size of the pyramid and to get something as below. Thank you
- How to draw tan(x) without pgfplot?by user108724 on January 27, 2020 at 4:42 pm
I want to know why output of the following MWE is ugly? i.e. yrange=-3:3 has no effect!! \documentclass[12pt]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \begin{tikzpicture}[domain=-4:4] \draw[very thin,color=gray] (-0.4,-4) grid (4,4); \draw[->] (-4.2,0) -- (4.2,0) node[right] {$x$}; \draw[->] (0,-4.2) -- (0,4.2) node[above] {$y$}; \draw[domain=-2*pi:2*pi, color=blue, samples=100, yrange=-3:3] plot[yrange=-3:3] (\x,{tan(\x r)}) node[right] {$f(x) = \tan x$}; \end{tikzpicture} \end{document}
- Custom checkbox symbolby azetina on July 22, 2019 at 3:16 am
Consider the following MWE: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[line width=3pt,rounded corners] (0.75,1)--(0,1)--(0,0) -- (1,0) -- (1,0.5); \draw[xshift=0cm,yshift=0.35cm,line width=3pt] (0.25,0.25)--(0.5,0)--(1,0.5); \end{tikzpicture} \end{document} How can I create the same diagram by using coordinate or node definition. I want to convert this into a usable symbol that I can scale at any size, say the current font size and usable in mathmode. I know fontawesome has \faCheckSquareO, but I designed this since I want full control over the color of the each component of the diagram.
- \circlearound: Misalign of the circle centerby Candu on April 25, 2019 at 5:58 pm
I am using the following code, which I found here at StackExchange to draw a circle around some letters: \newcommand\circlearound[1]{% \setbox0=\hbox{#1}% \dimen0\wd0% \divide\dimen0 by 2% \begin{tikzpicture}[baseline=(a.base)]% \useasboundingbox (-\the\dimen2,0pt) rectangle (\the\dimen0,1pt); \node[circle,draw,minimum size=1.4em,outer sep=0pt,inner sep=0.2ex] (a) {#1}; \end{tikzpicture} } This works fine for normal letter but there is a misalignment for cursive fonts (italic type). Therefore, I want to define a second command \circlearoundItalic in which I misalign the center of the circle by 0.2em. Does anybody know the TikZ code to move the center of the circle by 0.2em to the right? Thank you!
- Text wrap of an objectby Matvey Sokolovsky on March 26, 2019 at 2:00 pm
I didn't manage to deal with a wrapping of my object. The object is made by function (that I found here), which is an LFG f-structure. I would like to place it on the right side of the page, and being wrapped with text on the left. All the code: % META \documentclass{article} \usepackage{lipsum} \usepackage{array} \usepackage{tikz} % ADDITIONAL FUNCTIONS \def\lfgms#1{ % creating figure with f-structure from LFG. \mbox{ \tabcolsep0pt\arraycolsep0pt $ \left[% \begin{tabular}{@{}>{\scshape}l@{\hspace{5pt}}>{\small}l@{}}% #1% \end{tabular}% \rule{0mm}{5mm}% \right]% $% }\vspace{1mm} } \newcommand{\mynode}[2] %creating nodes for tikz-lines {\tikz[baseline=(#1.base), remember picture]\node[outer sep=0pt, inner sep=0pt] (#1) {#2};} %DOCUMENT \begin{document} \lipsum[1] \lfgms{ ~pred & ~‘want\;\guilsinglleft\textsc{subj comp}\guilsinglright’~~\\ \\ ~tam & ~PRS\\ \\ ~foc & \mynode{foc4_1}{}\\ \\ ~subj & \mynode{zaur4}{\lfgms{ ~pred & `Zaur'~~\\ ~case & GEN~}}\\ \\ ~comp & \lfgms{ ~pred & ~‘come\;\guilsinglleft\textsc{subj}\guilsinglright’~~\\ \\ ~tam & ~ PAST \\ \\ ~foc & \mynode{foc4_2}{}\\ \\ ~subj & \mynode{alan4}{\lfgms{ ~pred & ~‘Alan'~~\\ \\ ~case & ~NOM~\\ }} } } \begin{tikzpicture}[overlay,remember picture] \draw[-] (foc4_1.east) -- (zaur4.east); \draw[-] (foc4_2.east) -- (alan4.east); \end{tikzpicture} \end{document} Now they are placed like this: So I want all the paragraph to wrap the object placed on the right. I tried to apply wrapfigure and got no result. PS compilator is xelatex
- On scaling I get an errorby Tolaso on April 24, 2018 at 9:32 am
When I scale the following code \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=0.6] [bend angle =60,inner sep=0pt, minimum size =10mm,very thick, from/.style={<-}, towards/.style={->}, protein/.style={circle,draw=black,very thick}, reaction/.style={}] \node[protein] (p) at (-2,0) {$\mathcal{A}$}; \node[protein] (ps) at (2,0) {$f(\mathcal{A})$} edge [towards, bend left] node [pos=0.5, below] {$f^{-1}$} (p) edge [from, bend right] node [pos=0.5, above] {$f$} (p) ; \end{tikzpicture} \end{document} I get the following error Package pgfkeys Error: I do not know the key '/tikz/towards' and I am going to ignore it. Perhaps you misspelled it. ...ft] node [pos=0.5, below] {$f^{-1}$} (p) If I remove the [scale=0.6] everything is fine and it compiles normally. What's going on and how can I can scale the figure?
- Can Gaussian (or similar) blur be applied to Tikz text?by J. C. Salomon on November 12, 2017 at 11:06 pm
I’m trying to emulate in TikZ a title page which I’ve previously drawn in SVG. The image below is from the SVG version, where the shadowed text is achieved using a feGaussianBlur filter. But everything I’ve found regarding filters and shadows and such with TikZ seems not to apply to text. Is there a way to achieve this result? Current code (translated by hand from the SVG and adapted to my book layout): \documentclass[11pt,extrafontsizes]{memoir} \setstocksize{9in}{6in} \settrimmedsize{\stockheight}{\stockwidth}{*} \medievalpage[12] \checkandfixthelayout %\usepackage{fontspec} %\newfontfamily\gingerfont{RM Ginger} %\newcommand*{\ginger}[1]{\gingerfont\fontsize{#1}{#1}\selectfont} \newcommand*{\ginger}[1]{\normalfont\fontsize{#1}{#1}\selectfont} \usepackage{tikz} \usepackage{tikzpagenodes} \usetikzlibrary{calc,positioning,decorations.text} \tikzset{x=1in,y=1in} \begin{document} \thispagestyle{empty} \begin{tikzpicture}[remember picture,overlay,shift={($ (current page.south west) + (0.5, 0.5) $)}] \node at (2.5, 7) [font=\ginger{31.5}, anchor=base] {Unshadowed Text}; \draw[shift={(0, 5.75)}, decorate, decoration={text along path, text align=center, text={|\ginger{40.5}|The Long Title}}] (0, 0) .. controls (1, 0.5) and (1.625, 0.625) .. (2.5, 0.625) .. controls (3.375, 0.625) and (4, 0.5) .. (5, 0); \node at (2.5, 6.125) [font=\ginger{31.5}, anchor=base] {of}; \draw[shift={(0, 5)}, decorate, decoration={text along path, text align=center, text={|\ginger{81}|the Book}}] (0, 0) .. controls (1, 0.5) and (1.625, 0.625) .. (2.5, 0.625) .. controls (3.375, 0.625) and (4, 0.5) .. (5, 0); \node at (2.5, 4.25) [font=\ginger{47.25}, anchor=base] {A. U. Thor}; \node at (2.5, 3) [font=\ginger{31.5}, anchor=base] {More unshadowed text}; \node at (2.5, 2.5) [font=\ginger{27}, anchor=base] {and some more}; \end{tikzpicture} \end{document} What the SVG version looks like:
- Decision Tree in LaTeX with TikZby Karine on November 3, 2017 at 5:42 am
Grid line doesn't have to be included \documentclass[10pt]{beamer} \usetheme{default} \usepackage{graphicx} \usepackage{amssymb,amsmath} \usepackage{tikz} \usetikzlibrary{matrix} \usepackage{adjustbox} \usepackage{caption} \ usepackage{subcaption} \setbeamercolor{title}{fg=black} \setbeamercolor{subtitle}{fg=gray} \setbeamercolor{footlinecolor}{fg=white,bg=green} \setbeamertemplate{footline}[text line]{% \parbox{\linewidth}{\vspace*{-10pt} \textit{Where Wall Street Goes to School} \hfill \insertpagenumber} } \setbeamertemplate{navigation symbols}{} – \begin{tikzpicture}[>=stealth,sloped][scale=0.8] \matrix (tree) [matrix of nodes, minimum size=0.25cm, column sep=2cm, row sep=1cm, ] { & $C_{i+1,j+1}$ \\ $C_{i,j}$ &$C_{i+1,j}$ \\ & $C_{i+1,j-1}$ \\ }; \draw[->] (tree-3-1) -- (tree-1-3) node [midway,above] {}; \draw[->] (tree-3-1) -- (tree-3-3) node [midway,above] {}; \draw[->] (tree-3-1) -- (tree-5-3) node [midway,below] {}; \end{tikzpicture} \end{adjustbox} –
- Highlight function in minted with background colorby jakun on June 21, 2017 at 12:30 pm
I would like to highlight a function in minted by giving it a background color in order to make the connection to a visualization better visible. I used to put the functions to be highlighted in a separate minted environment and specify a background color for the entire environment (in minted v1.7): % minted 2011/09/17 v1.7 \documentclass{article} \usepackage{minted} \newminted{c}{linenos, tabsize=4, gobble=2} \makeatletter \newenvironment{mintedBlock}{% % I can not use frame=topline|bottomline because that is inside of colored box % copied from /usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty line 918 in \def\FV@SingleFrameLine \noindent \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}% }{% \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}% } \makeatother \newcommand{\colorMain}{green!10}% \newcommand{\colorSum}{yellow!20}% \begin{document} \begin{mintedBlock} % I am using old package versions which are buggy, so firstnumber=last gives wrong numbering. \begin{ccode*}{frame=none, bgcolor=white} #include <stdio.h> \end{ccode*} \begin{ccode*}{frame=none, firstnumber=2, bgcolor=white} \end{ccode*} \begin{ccode*}{frame=none, firstnumber=3, bgcolor=\colorSum} int sum(int summand1, int summand2) { return summand1 + summand2; } \end{ccode*} \begin{ccode*}{frame=none, firstnumber=7, bgcolor=white} \end{ccode*} \begin{ccode*}{frame=none, firstnumber=8, bgcolor=\colorMain} int main() { int summand1 = 1; int summand2 = 2; printf("%d + %d = %d\n", summand1, summand2, sum(summand1, summand2)); } \end{ccode*} \end{mintedBlock} \end{document} The spacing of the rules was not perfect but apart from that it was good enough in minted 1.7. However I have recently upgraded to the newest version (minted 2.4.2dev) and now there are big spaces between the seperate minted environments. I have tried to remove them with \renewcommand{\vspace}{\@ifnextchar*\@gobbletwo\@gobble}% which makes it a lot better but still leaves too big spaces. Therefore I have tried it with a new approach: using escapeinside to insert tikz nodes with remember picture and drawing a rectangle around them later on. % minted 2017/02/10 v2.4.2dev \documentclass{article} \usepackage{minted} \newminted{c}{linenos, frame=lines, tabsize=4, gobble=1} \usepackage{tikz} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture,baseline=(#1.base)] \node (#1) {\vphantom{I}};} \newcommand{\colorMain}{green!10}% \newcommand{\colorSum}{yellow!20}% \begin{document} \begin{ccode*}{breaklines, escapeinside=~~} #include <stdio.h> ~\tikzmark{sumtop}~int sum(int summand1, int summand2) { return summand1 + summand2; ~\tikzmark{sumbottom}~} ~\tikzmark{maintop}~int main() { int summand1 = 1; int summand2 = 2; printf("%d + %d = %d\n", summand1, summand2, sum(summand1, summand2)); ~\tikzmark{mainbottom}~} \end{ccode*} \begin{tikzpicture}[remember picture, overlay] \path[overlay, fill=\colorSum] (sumtop.north) rectangle ([xshift=\linewidth]sumbottom.south); \path[overlay, fill=\colorMain] (maintop.north) rectangle ([xshift=\linewidth]mainbottom.south); \end{tikzpicture} \end{document} Unfortunately the tikz picture is above the minted code. How can I put the tikzpicture behind the text? Also, I am not a hundred percent happy with this approach because I will run into problems if the code happens to move across a pagebreak. Does someone have a better idea?
- How to draw the following pictures?by bing on May 23, 2016 at 2:15 am
I want to draw the following pictures, but I don't know how to draw it. Could anyone help me?
- plotting a function in 3d plotby WeakLearner on September 18, 2015 at 3:14 am
I want to plot functions within the simplex, but every time I add a function in the usual 2d plot way i get an error. How can I add a function of two variables, for example x^2+y^2 =0.5, here is the example: \documentclass[11pt]{article} \usepackage{tikz} \usepackage{tikz-3dplot} \usepackage{ifthen} \begin{document} \tdplotsetmaincoords{80}{130} \begin{tikzpicture}[scale=2,tdplot_main_coords] \coordinate (O) at (1,0,0); \coordinate (P) at (0,1,0); \coordinate (Q) at (0,0,1); \draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$}; \draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$}; \draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$}; \draw[thick,color=red] (O) -- (P); \draw[thick, color=red] (P) -- (Q); \draw[thick, color=red] (Q) -- (O); \end{tikzpicture} \end{document} update I tried with a different piece of code, but I still cannot write in a function of two different variables: \documentclass[border=3pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[ view/h=135, axis lines=center, xmax=1.5, ymax=1.5, zmax=1.5, ytick={1}, xlabel={$x_{1}$}, ylabel={$x_{2}$}, zlabel={$x_{3}$}, ] \addplot3[patch,blue!70!black!50,forget plot] coordinates { (1,0,0) (0,1,0) (0,0,1) }; \addplot3[no markers,red!90!black] coordinates { (0.25,0.1,0.45) (0.2,0.1,0.4) (0.24,0.36,0.4) (0.16,0.32,0.62) (0.12,0.3,0.58) (0.1,0.26,0.64) }; \addplot3[domain=0:2, red, thick] {x^2+y^2}; \node[fill=red!90!black,inner sep=1pt,circle,label={180:$Y$}] at (axis cs:0.1,0.26,0.64) {}; \end{axis} \end{tikzpicture} \end{document} For example, here I did x^2, which works, but I want to write y^2 for example which doesnt work, or z^2.. or any function of two variables. Note: the x^2 isn't actually the graph i want but im just trying to get the code to work for any function of two variables update 2 I had forgotten to use \addplot3, it seems to be working now.
- Draw a 2D functions in tikzby Dipole on August 4, 2015 at 10:58 am
I want to be able to plot in a 3D environment any type of function of two variables z = f(x,y), where x and y are specified within a given range. For instance plot f(x,y) = x^2 + y^2 where x in [-2,2] and y in [-2,2] as a "wireframe" surface plot. I want this plot to go on the rectangle (defined in the same coordinate system) that I have drawn, without the axis labels. How can this be done \documentclass[border=10pt,varwidth]{standalone} \usepackage{tikz,tikz-3dplot} \usepackage{pgfplots} \pgfplotsset{ every axis/.append style = {thick},tick style = {thick,black}, % % #1 = x, y, or z % #2 = the shift value /tikz/normal shift/.code 2 args = {% \pgftransformshift{% \pgfpointscale{#2}{\pgfplotspointouternormalvectorofticklabelaxis{#1}}% }% },% % range3frame/.style = { tick align = outside, scaled ticks = false, enlargelimits = false, ticklabel shift = {10pt}, axis lines* = left, line cap = round, clip = false, xtick style = {normal shift={x}{10pt}}, ytick style = {normal shift={y}{10pt}}, ztick style = {normal shift={z}{10pt}}, x axis line style = {normal shift={x}{10pt}}, y axis line style = {normal shift={y}{10pt}}, z axis line style = {normal shift={z}{10pt}}, } } \begin{document} % ----- First plot \tdplotsetmaincoords{70}{155} \begin{tikzpicture} [scale=3, tdplot_main_coords, axis/.style={->,blue,thick}, vector/.style={-stealth,black,very thick}, vector guide/.style={dotted,black,thick}, ] %standard tikz coordinate definition using x, y, z coords \coordinate (O) at (0,-0.5,0); %tikz-3dplot coordinate definition using r, theta, phi coords \pgfmathsetmacro{\ax}{1} \pgfmathsetmacro{\ay}{-1} \pgfmathsetmacro{\az}{0.5} \coordinate (P) at (\ax,\ay,\az){}; %draw axes \draw[axis] (0,-0.5,0) -- (2,-0.5,0) node[anchor=north east]{$y$}; % x-axis becomes y axis \draw[axis] (0,-0.5,0) -- (0,-2,0) node[anchor=south]{$x$}; %minius y-axis becomes positive x axis \draw[axis] (0,-0.5,0) -- (0,-0.5,2) node[anchor=south]{$z$}; \draw[thick,tdplot_main_coords] (1.5,0.5,0)-- (1.5,-0.5,0) -- (-1.5,-0.5,0)--(-1.5,0.5,0)--cycle; \begin{axis}[range3frame, view={55}{45}] \addplot3[surf, colormap/hot2, samples=41, domain=0:2] {0.1*(x^2+y^2)}; \end{axis} \end{tikzpicture} \end{document}
- Absolute positioning and blend groups in TikZby Marcos on June 5, 2015 at 4:05 pm
In order to have absolute positioning of a tikzpicture (meaning, in terms of the "current page" node), we need to set the "overlay" option for the picture. It seems there is a conflict between this and setting blend groups within the picture. If this is so, is there a way to circumvent it? I'd like to have both functionalities working together in the same tikzpicture. As an MWE, take \documentclass[11pt]{article} \usepackage{tikz} \pagestyle{empty} \begin{document} \begin{tikzpicture}[ remember picture, overlay,%<- Comment and uncomment to check the difference every path/.append style={fill opacity=0.75}, ] \begin{scope}[blend group=lighten] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[xshift=6cm,blend group=darken] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[xshift=12cm,blend mode=multiply] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[yshift=-4cm,blend group=screen] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[yshift=-8cm,blend group=overlay] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \end{tikzpicture} \end{document}
- How to incorporate and scale matplotlib plots in latex using the PGF backend?by Nils_M on September 20, 2013 at 3:09 pm
I am using the pgf backend of matplotlib to generate pgf files which I want to put into my latex document using tikzscale to be able to resize them easily. Example python code: #!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib as mpl mpl.use('pgf') import numpy as np import matplotlib.pyplot as mplp mpl.rcParams['text.latex.unicode']=True mpl.rcParams['text.usetex']=True mpl.rcParams['pgf.texsystem'] = 'pdflatex' fig = mplp.figure() ax = fig.add_subplot(111) x = np.arange(0,2 * np.pi, .1) data = np.sin(x) fmt = {"lw" : 3, "c" : "r", "ls" : '-'} ax.plot(x, data, label=r"sample data with greek $\mu$", **fmt) ax.set_ylabel(r"sample", rotation=0) ax.legend() fig.set_size_inches(1.41,1.) # fig.savefig('./sample.pgf', dpi=500, bbox_inches='tight') fig.savefig('./sample.pgf', dpi=500) Example latex code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usepackage{tikzscale} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \newcommand{\includepgf}[4] { \begin{figure} \centering \includegraphics{#1} \includegraphics[width=#2\textwidth, height=#2*0.7071428571428572\textwidth]{#1} \includegraphics[width=#2\textwidth, axisratio=0.7071428571428572]{#1} \caption[]{#4} \label{#3} \end{figure} } \begin{document} \includepgf{sample.pgf}{.9}{fig:sample}{Sample Figure} \end{document} Unfortunately the following happens for the three different \includegraphics commands: Works as expected, includes plot in original size Compiles with Package tikzscale Warning: Scaling of sample.pgf's width was only (tikzscale) accurate to 208.59694pt on input line 27. Package tikzscale Warning: Scaling of sample.pgf's height was only (tikzscale) accurate to 147.29488pt on input line 27. no resizing in final pdf file. Does not compile, gives ! Package tikzscale Error: Requested to scale unscalable graphic.
- Pascal's triangle in tikzby dalibor.zeleny on May 6, 2011 at 12:21 am
I would like to typeset the top part of Pascal's triangle. To get the triangle with the names of the binomial coefficients, i.e., {n \choose k}, I used the following code \begin{tikzpicture} \foreach \n in {0,...,4} { \foreach \k in {0,...,\n} { \node at (\k-\n/2,-\n) {${\n \choose \k}$}; } } \end{tikzpicture} The result is this Now I want to be equally lazy and do something like this for the values of the binomial coefficients, i.e., replace {\n \choose \k} in the node label with \CalculateBinomialCoefficient{\n}{\k} where \CalculateBinomialCoefficient is a hypothetical macro that calculates the binomial coefficient. Has anyone done something like that? The result should look like this: