177

I understand that this post may cause some down votes because it seems a bit off-topic, but having seen the discussions on Christmas Tree with LaTeX I am still willing to try.

How do you draw a red cute love heart using LaTeX?

9

16 Answers 16

172

Use shapepar to write your note:

\documentclass[svgnames]{article}
\usepackage{fontspec,microtype,shapepar,xcolor}
\setmainfont{TeX Gyre Chorus}
\begin{document}
\textcolor{Crimson}{\heartpar{Lorem ipsum dolor sit amet, consectetuer
    adipiscing elit, sed diam nonummy nibh euismod tincidunt ut
    laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim
    veniam, quis nostrud exerci tation ullamcorper suscipit lobortis
    nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
    dolor in hendrerit in vulputate velit esse molestie consequat, vel
    illum dolore eu feugiat nulla facilisis at vero eros et accumsan
    et iusto odio dignissim qui blandit praesent luptatum zzril
    delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum
    dolor sit amet, consectetuer adipiscing elit, sed diam nonummy
    nibh euismod tincidunt ut laoreet dolore magna aliquam erat
    volutpat.}}
\end{document}

The longer your note, and the shorter or more “hyphenatable” your words toward the end of the note, the more likely it is that shapepar will produce a pleasing shape, without rivers or the underfull lines seen in my image; I recommend microtype for the same reason.

enter image description here

12
  • Why I end up with this error? I am using TexMaker XeLaTeX. ! Undefined control sequence.<argument> \c_keys_code_root_tlfontspec/Ligatures/Historic ...tureoption{Ligatures}{Historic}{Historical} and ! fontspec error: "font-not-found"!! The font "TeX Gyre Chorus" cannot be found.!! See the fontspec documentation for further information.!! For immediate help type H <return>.!............................................... \setmainfont{TeX Gyre Chorus} Oct 21, 2013 at 6:50
  • 6
    +1: Combine it with a love poem and you have a truely romantic love heart!
    – Daniel
    Oct 21, 2013 at 9:40
  • @perfectionm1ng TeX Gyre Chorus does not have the hlig feature, only the dlig (use Ligatures=Rare or Ligatures=Discretionary). But that wouldn’t account for the “font-not-found.” Which operating system do you use?
    – Thérèse
    Oct 21, 2013 at 10:05
  • @perfectionm1ng shapepar doesn't require any particular fonts, or xetex, so you can experiment with any fonts you normally use. Oct 22, 2013 at 1:56
  • 1
    @perfectionm1ng -- What David means is you can simply not load fontspec and (therefore) skip the \setmainfont command. If you are using regular pdflatex, simply add \usepackage[T1]{fontenc} (recommended) and choose a font from the LaTeX font catalogue.
    – jon
    Oct 22, 2013 at 5:03
100

I know this is a bit late, but for reference, OP didn't say what sort of PhD...

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[yscale=-1]
\draw[fill=red!30!white](.456,3.236)
    .. controls (.422,4.168) and (.408,5.095) .. (.461,6.046)
    .. controls (.475,6.228) and (.365,6.400) .. (.379,6.601)
    -- (.819,11.816)
    .. controls (.843,12.194) and (.838,13.389) .. (.900,13.972)
    .. controls (.943,14.340) and (2.870,14.340) .. (2.903,13.972)
    .. controls (2.927,13.699) and (2.932,13.436) .. (2.903,13.169)
    -- (1.847,5.401)
    .. controls (1.914,4.627) and (2.033,3.924) .. (2.129,3.193)
    .. controls (2.177,2.906) and (.441,2.863) .. (.456,3.236) ;
\draw[fill=red!30!white] (.456,3.236)
    .. controls (.422,4.168) and (.408,5.095) .. (.461,6.046)
    .. controls (.475,6.228) and (.365,6.400) .. (.379,6.601)
    -- (.819,11.816)
    .. controls (.843,12.194) and (.838,13.389) .. (.900,13.972)
    .. controls (.943,14.340) and (2.870,14.340) .. (2.903,13.972)
    .. controls (2.927,13.699) and (2.932,13.436) .. (2.903,13.169)
    -- (1.847,5.401)
    .. controls (1.914,4.627) and (2.033,3.924) .. (2.129,3.193)
    .. controls (2.177,2.906) and (.441,2.863) .. (.456,3.236) ;
\draw[fill=red!60!white] (.303,6.697)
    .. controls (-.161,7.442) and (-.022,9.641) .. (.484,11.118)
    .. controls (.795,12.022) and (1.297,12.414) .. (2.062,12.801)
    .. controls (3.429,13.513) and (5.112,13.714) .. (6.598,13.795)
    .. controls (9.495,13.957) and (9.738,11.735) .. (8.974,8.967)
    .. controls (8.744,8.126) and (8.123,7.815) .. (7.917,7.222)
    .. controls (7.683,6.606) and (7.310,5.999) .. (6.598,5.420)
    .. controls (5.570,4.579) and (1.230,5.210) .. (.303,6.697) ;
\fill[fill=red!25!white] (2.540,6.405)
    .. controls (2.296,6.257) and (1.890,6.300) .. (1.608,6.424)
    .. controls (1.274,6.577) and (1.101,6.802) .. (1.001,7.151)
    .. controls (.858,7.652) and (1.025,8.293) .. (1.106,8.795)
    .. controls (1.149,9.072) and (1.149,9.402) .. (1.254,9.684)
    .. controls (1.278,9.746) and (1.278,9.823) .. (1.360,9.870)
    .. controls (1.426,9.909) and (1.412,9.732) .. (1.460,9.651)
    .. controls (1.747,9.144) and (2.210,8.346) .. (2.502,7.834)
    .. controls (2.602,7.657) and (2.631,7.437) .. (2.531,7.303)
    .. controls (2.411,7.146) and (2.206,6.883) .. (2.306,6.768)
    .. controls (2.382,6.682) and (2.621,6.453) .. (2.540,6.405) ;
\fill[fill=red!25!white] (4.204,6.606)
    .. controls (5.413,6.434) and (5.327,7.543) .. (5.466,7.796)
    .. controls (5.599,8.054) and (6.350,8.785) .. (6.498,9.029)
    .. controls (6.646,9.273) and (7.282,9.947) .. (7.067,10.616)
    .. controls (6.847,11.290) and (5.776,11.582) .. (5.212,11.429)
    .. controls (4.643,11.271) and (3.773,10.941) .. (3.166,11.113)
    .. controls (2.559,11.280) and (1.350,10.793) .. (1.790,10.052)
    .. controls (2.225,9.311) and (3.640,6.692) .. (4.204,6.606) ;
\draw[fill=yellow] (1.307,3.107)
    .. controls (1.675,3.107) and (1.976,3.169) .. (1.976,3.250)
    .. controls (1.976,3.327) and (1.675,3.394) .. (1.307,3.394)
    .. controls (.934,3.394) and (.633,3.327) .. (.633,3.250)
    .. controls (.633,3.169) and (.934,3.107) .. (1.307,3.107) ;
\draw[fill=blue!20!red!80!white] (1.307,3.107)
    .. controls (1.675,3.107) and (1.976,3.169) .. (1.976,3.250)
    .. controls (1.976,3.327) and (1.675,3.394) .. (1.307,3.394)
    .. controls (.934,3.394) and (.633,3.327) .. (.633,3.250)
    .. controls (.633,3.169) and (.934,3.107) .. (1.307,3.107) ;
\fill[fill=red!10!white] (1.024,14.000)
    .. controls (.991,13.929) and (.924,12.146) .. (1.039,12.323)
    .. controls (1.120,12.452) and (1.498,12.753) .. (1.870,12.767)
    .. controls (2.004,12.777) and (1.918,14.129) .. (1.875,14.163)
    .. controls (1.789,14.230) and (1.110,14.173) .. (1.024,14.000) ;
\fill[fill=red!10!white] (.618,3.432)
    -- (.618,6.247)
    .. controls (.852,5.941) and (1.086,5.745) .. (1.345,5.578)
    .. controls (1.364,5.033) and (1.368,4.125) .. (1.345,3.556)
    .. controls (1.096,3.556) and (.862,3.518) .. (.618,3.432) ;
\draw[fill=white] (4.872,5.215)
    .. controls (4.944,5.607) and (4.891,5.884) .. (4.595,6.061)
    .. controls (4.389,6.185) and (3.749,6.013) .. (3.864,5.664)
    .. controls (3.974,5.339) and (4.088,5.081) .. (4.346,4.923)
    .. controls (4.533,4.813) and (4.858,5.119) .. (4.872,5.215) ;

\draw[fill=red!80!blue] (5.662,5.665)
    .. controls (5.643,5.732) and (5.624,5.803) .. (5.604,5.880)
    .. controls (5.944,6.076) and (6.355,6.640) .. (6.522,7.314)
    .. controls (6.699,8.031) and (6.336,8.284) .. (5.853,8.796)
    .. controls (5.523,9.154) and (5.313,9.541) .. (5.303,10.014)
    .. controls (5.485,9.106) and (5.844,8.958) .. (6.030,8.877)
    .. controls (6.278,8.767) and (6.221,9.221) .. (6.159,10.029)
    .. controls (6.341,9.412) and (6.298,8.944) .. (6.274,8.752)
    .. controls (6.245,8.561) and (6.589,8.370) .. (6.685,8.093)
    .. controls (6.799,7.777) and (6.924,8.069) .. (6.991,8.208)
    .. controls (7.153,8.547) and (7.311,8.681) .. (7.263,8.987)
    .. controls (7.096,10.033) and (6.780,10.387) .. (6.250,10.650)
    .. controls (6.728,10.492) and (6.833,10.373) .. (6.976,10.230)
    .. controls (6.991,10.440) and (6.900,10.870) .. (6.962,11.209)
    .. controls (6.957,10.669) and (7.277,9.197) .. (7.469,9.044)
    .. controls (7.579,8.953) and (8.296,9.632) .. (8.372,10.139)
    .. controls (8.458,10.698) and (8.936,11.535) .. (8.716,12.213)
    .. controls (8.970,11.458) and (8.535,10.636) .. (8.635,10.445)
    .. controls (8.778,10.641) and (9.060,11.037) .. (9.027,11.257)
    .. controls (8.994,11.477) and (9.170,11.874) .. (9.094,12.333)
    .. controls (9.228,11.883) and (9.065,11.702) .. (9.118,11.377)
    .. controls (9.166,11.052) and (8.979,10.626) .. (8.836,10.359)
    .. controls (8.549,9.828) and (7.889,9.187) .. (7.373,8.595)
    .. controls (7.708,8.796) and (8.535,9.077) .. (8.487,9.369)
    .. controls (8.434,9.661) and (8.860,9.900) .. (9.027,10.306)
    .. controls (8.903,9.928) and (8.587,9.656) .. (8.568,9.321)
    .. controls (8.554,8.982) and (8.023,8.815) .. (7.889,8.762)
    .. controls (7.995,8.752) and (8.253,8.748) .. (8.348,8.834)
    .. controls (8.444,8.920) and (8.702,9.097) .. (8.912,9.044)
    .. controls (8.539,9.044) and (8.463,8.671) .. (8.286,8.657)
    .. controls (8.109,8.647) and (7.641,8.566) .. (7.531,8.470)
    .. controls (7.015,8.016) and (6.599,7.223) .. (6.819,7.271)
    .. controls (7.344,7.381) and (7.899,7.471) .. (8.377,7.988)
    .. controls (8.023,7.567) and (7.999,7.562) .. (7.478,7.314)
    .. controls (7.091,7.137) and (6.537,6.979) .. (6.355,6.511)
    .. controls (6.250,6.229) and (5.887,5.789) .. (5.662,5.665) ;
\draw[fill=red!80!blue] (3.387,5.951)
    .. controls (3.779,7.003) and (2.665,8.600) .. (1.857,9.866)
    .. controls (1.384,10.607) and (1.704,11.157) .. (2.364,11.305)
    .. controls (2.842,11.410) and (4.515,11.004) .. (4.993,11.023)
    .. controls (5.480,11.037) and (5.604,10.856) .. (5.882,10.559)
    .. controls (5.815,10.894) and (5.256,11.305) .. (4.997,11.209)
    .. controls (4.735,11.114) and (4.199,11.229) .. (3.975,11.338)
    .. controls (4.280,11.425) and (4.787,11.401) .. (5.179,11.601)
    .. controls (5.571,11.802) and (5.920,11.750) .. (6.159,11.300)
    .. controls (6.140,11.730) and (5.538,11.955) .. (5.126,11.783)
    .. controls (4.715,11.616) and (3.736,11.434) .. (3.401,11.434)
    .. controls (3.176,11.429) and (3.009,11.468) .. (2.617,11.563)
    .. controls (3.324,11.635) and (4.252,12.084) .. (5.165,12.304)
    .. controls (5.863,12.471) and (6.680,12.452) .. (6.790,12.189)
    .. controls (6.895,11.946) and (7.072,11.840) .. (7.473,11.793)
    .. controls (7.000,12.008) and (6.866,12.156) .. (6.814,12.438)
    .. controls (7.015,12.490) and (7.411,12.256) .. (7.626,12.457)
    .. controls (7.846,12.658) and (8.439,12.653) .. (8.864,12.381)
    .. controls (8.386,12.730) and (7.770,12.710) .. (7.607,12.557)
    .. controls (7.445,12.405) and (7.077,12.553) .. (6.862,12.591)
    .. controls (6.647,12.634) and (6.446,12.644) .. (5.891,12.548)
    .. controls (5.714,12.620) and (5.657,12.715) .. (5.867,12.792)
    .. controls (6.082,12.835) and (6.537,12.806) .. (7.014,12.806)
    .. controls (7.258,12.806) and (7.430,12.935) .. (7.631,12.811)
    .. controls (7.832,12.682) and (8.033,12.873) .. (8.324,13.016)
    .. controls (7.999,12.906) and (7.746,12.768) .. (7.660,12.897)
    .. controls (7.574,13.031) and (7.263,12.916) .. (7.163,12.940)
    .. controls (7.292,12.992) and (7.493,12.935) .. (7.507,13.136)
    .. controls (7.526,13.337) and (8.057,13.284) .. (7.999,13.652)
    .. controls (7.923,13.294) and (7.540,13.423) .. (7.406,13.179)
    .. controls (7.277,12.940) and (6.885,13.055) .. (6.680,13.031)
    .. controls (6.250,12.973) and (5.557,13.074) .. (5.461,12.639)
    .. controls (5.217,12.600) and (4.921,12.514) .. (4.682,12.419)
    .. controls (4.687,12.538) and (5.103,13.026) .. (5.461,13.102)
    .. controls (5.815,13.174) and (6.532,13.155) .. (6.699,13.681)
    .. controls (6.345,13.174) and (5.614,13.356) .. (5.294,13.260)
    .. controls (4.978,13.160) and (4.213,12.285) .. (3.898,12.189)
    .. controls (3.583,12.099) and (3.272,11.922) .. (3.157,11.989)
    .. controls (3.062,12.084) and (3.119,12.600) .. (3.583,12.581)
    .. controls (4.046,12.562) and (4.362,12.882) .. (4.620,13.356)
    .. controls (4.271,12.897) and (3.721,12.615) .. (3.358,12.744)
    .. controls (2.990,12.868) and (2.823,11.936) .. (2.598,11.812)
    .. controls (2.373,11.683) and (1.594,11.377) .. (1.503,11.042)
    .. controls (1.465,11.377) and (2.106,11.903) .. (2.043,12.677)
    .. controls (1.953,11.922) and (1.522,11.783) .. (1.317,11.377)
    .. controls (1.111,10.966) and (1.212,10.555) .. (1.417,9.991)
    .. controls (1.422,9.971) and (3.836,6.267) .. (2.588,5.985)
    .. controls (2.235,5.904) and (1.981,5.813) .. (1.757,5.660)
    .. controls (1.871,4.489) and (2.187,2.481) .. (2.650,2.405)
    .. controls (3.176,2.314) and (4.185,2.878) .. (4.175,3.289)
    .. controls (4.166,3.724) and (3.817,4.766) .. (3.994,5.201)
    .. controls (3.759,5.397) and (3.277,5.617) .. (3.387,5.951) ;
\fill[fill=red!90!blue!70!white] (2.942,5.378)
    .. controls (2.875,5.339) and (2.736,5.378) .. (2.722,5.459)
    .. controls (2.712,5.535) and (2.741,5.583) .. (2.779,5.674)
    .. controls (3.013,6.066) and (3.200,6.716) .. (2.980,7.266)
    .. controls (2.803,7.720) and (2.564,8.226) .. (2.296,8.661)
    .. controls (2.048,9.068) and (1.627,9.670) .. (1.565,10.363)
    .. controls (1.579,10.105) and (1.837,9.737) .. (1.952,9.512)
    .. controls (2.263,8.905) and (3.071,7.815) .. (3.214,7.180)
    .. controls (3.362,6.534) and (3.243,5.875) .. (3.071,5.597)
    .. controls (3.066,5.540) and (3.028,5.425) .. (2.942,5.378) ;
\fill[fill=red!90!blue!70!white] (2.793,2.424)
    .. controls (2.253,3.542) and (2.115,3.948) .. (2.014,5.712)
    .. controls (2.019,5.784) and (2.349,5.903) .. (2.339,5.841)
    .. controls (2.301,4.665) and (2.650,3.289) .. (3.138,2.486)
    .. controls (3.032,2.447) and (2.870,2.419) .. (2.793,2.424) ;
\draw (2.526,6.104)
    .. controls (2.990,5.937) and (2.541,6.688) .. (2.545,6.673)
    .. controls (2.454,6.831) and (2.521,6.869) .. (2.564,6.922)
    .. controls (2.717,7.123) and (2.932,7.165) .. (2.660,7.471) ;
\draw (.461,3.241)
    .. controls (.576,3.657) and (2.187,3.657) .. (2.129,3.198) ;
\draw[fill=red!30!white] (3.687,5.731)
    .. controls (3.520,6.229) and (5.541,6.616) .. (5.556,6.214)
    .. controls (5.570,5.827) and (5.790,5.325) .. (5.800,4.919)
    .. controls (5.809,4.584) and (4.480,4.250) .. (4.308,4.517)
    .. controls (4.084,4.866) and (3.854,5.249) .. (3.687,5.731) ;
\draw (4.299,4.531)
    .. controls (4.189,4.885) and (5.752,5.315) .. (5.800,4.961) ;
\draw[fill=blue!20!red!80!white] (5.097,4.594)
    .. controls (5.436,4.694) and (5.699,4.823) .. (5.680,4.919)
    .. controls (5.656,5.009) and (5.360,5.000) .. (5.020,4.899)
    .. controls (4.681,4.799) and (4.428,4.675) .. (4.452,4.584)
    .. controls (4.475,4.493) and (4.757,4.493) .. (5.097,4.594) ;
\end{tikzpicture}

\end{document}

enter image description here

5
84

Still version:

enter image description here

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-plot}

\def\x(#1){sin(#1)^3}
\def\y(#1){(13*cos(#1)-5*cos(2*#1)-2*cos(3*#1)-cos(4*#1))/16}

\psset{algebraic,plotpoints=100}

\begin{document}

\begin{pspicture}[showgrid=bottom](-2,-2)(2,2)
    \psparametricplot[origin={0,0.15}]{0}{\psPiTwo}{\x(t)|\y(t)}
\end{pspicture}

\end{document}

Animated version:

enter image description here

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\FPeval\Delta{round(2*pi/30:2)}

\def\x(#1){sin(#1)^3}
\def\y(#1){(13*cos(#1)-5*cos(2*#1)-2*cos(3*#1)-cos(4*#1))/16}

\psset{algebraic,plotpoints=100}

\begin{document}
\multido{\n=0.00+\Delta}{31}{%
\begin{pspicture}[showgrid=false](-1.5,-1.5)(1.5,1.5)
    \psparametricplot[origin={0,0.15},linecolor=red]{0}{\n}{\x(t)|\y(t)}
\end{pspicture}}

\end{document}

Photo Clipper

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{graphicx}
\newsavebox\IBox
\savebox\IBox{\includegraphics{pretty}}
\usepackage{pst-plot}

\def\x(#1){sin(#1)^3}
\def\y(#1){(13*cos(#1)-5*cos(2*#1)-2*cos(3*#1)-cos(4*#1))/16}

\psset
{
    algebraic,
    plotpoints=100,
    xunit=.5\wd\IBox,
    yunit=.5\ht\IBox,
}

\usepackage{mathtools}
\begin{document}

\begin{pspicture}[showgrid=false](-1,-1)(1,1.5)
\begin{psclip}{\psparametricplot[origin={0,0.15}]{0}{\psPiTwo}{\x(t)|\y(t)}}
\rput(0,0){\usebox\IBox}
\end{psclip}
\rput(0,1.25){%
    \color{red}\large
    $\displaystyle\!
    \begin{aligned}
        x(t)&=\sin^3 t\\
        y(t)&=(13\cos t -5\cos 2t -2\cos 3t -\cos 4t)/16
    \end{aligned}$}
\rput(0,1){HAPPY BIRTHDAY}
\end{pspicture}

\end{document}

enter image description here

PDF animated version

Compile it with pdflatex -shell-escape filename as there are some \immediate\write18{} in my code below.

\documentclass[preview,border=12pt]{standalone}
\usepackage{filecontents}
\begin{filecontents*}{heart.tex}
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{graphicx}
\newsavebox\IBox
\savebox\IBox{\includegraphics[scale=3]{example-grid-100x100pt}}
\usepackage{pst-plot}

\def\x(#1){sin(#1)^3}
\def\y(#1){(13*cos(#1)-5*cos(2*#1)-2*cos(3*#1)-cos(4*#1))/16}

\psset
{
    algebraic,
    plotpoints=1000,
    xunit=.5\wd\IBox,
    yunit=.5\ht\IBox,
    linewidth=10pt,
}

\usepackage[nomessages]{fp}
\FPeval\Delta{round(2*pi/30:2)}
\usepackage{mathtools}
\begin{document}

\multido{\n=0.00+\Delta}{31}{%
\begin{pspicture}[showgrid=false](-1,-1)(1,1.5)
\begin{psclip}{\psparametricplot[origin={0,0.15}]{0}{\psPiTwo}{\x(t)|\y(t)}}
\rput(0,0){\usebox\IBox}
\end{psclip}
\rput(0,1.25){%
    \color{red}\large
    $\displaystyle\!
    \begin{aligned}
        x(t)&=\sin^3 t\\
        y(t)&=(13\cos t -5\cos 2t -2\cos 3t -\cos 4t)/16
    \end{aligned}$}
\rput(0,1){HAPPY BIRTHDAY}
\psparametricplot[origin={0,0.15},linecolor=red]{0}{\n}{\x(t)|\y(t)}
\end{pspicture}}

\end{document}
 \end{filecontents*}

\usepackage{animate}
\immediate\write18{latex heart}
\immediate\write18{dvips heart}
\immediate\write18{ps2pdf heart.ps}
\begin{document}
\animategraphics[controls,autoplay,loop,scale=1]{7}{heart}{}{}
\end{document}

enter image description here

9
  • 18
    As usual, please focus on the code rather than on the dummy picture. Oct 20, 2013 at 18:16
  • 14
    Sorry I can't do that. I don't even see the browser window :)
    – percusse
    Oct 20, 2013 at 22:36
  • 8
    Yes I will marry her. Wait, what question... :) Oct 21, 2013 at 0:51
  • 6
    Hopefully they up-voted for my code and not for the dummy picture. Oct 21, 2013 at 8:58
  • 8
    @Marienplatz no, they didn't (but I did:-) Oct 22, 2013 at 1:54
59

A three-dimensional version- nice to have an application of volumes of revolution

screenshot

% arara: pdflatex
% !arara: indent: {overwrite: on}
\documentclass{standalone}
\usepackage{pgfplots}

\pgfplotsset{compat=1.9}
\pgfplotsset{
    /pgfplots/colormap={pink}{color(0cm)=(purple); color(1cm)=(pink!80!purple); color(2cm)=(pink!90); color(3cm)=(pink) }
}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            view={0}{10},
            axis equal,
            axis lines=none,
            colormap name =pink, 
        ]
        \addplot3[
            surf,
            shader=faceted,
            samples=50,
            domain=0:2*pi,y domain=0:2*pi,
            z buffer=sort,
        opacity=0.15]
        (
        {(sin(deg(x)))^3*cos(deg(y))},
        {(sin(deg(x)))^3*sin(deg(y))},
        {(13*cos(deg(x))-5*cos(2*deg(x))-2*cos(3*deg(x))-cos(4*deg(x)))/16}
        );
    \end{axis}
\end{tikzpicture}

\end{document}
5
  • 4
    For my wife :) Maybe this will convince her to learn LaTeX and join the site?
    – cmhughes
    Oct 21, 2013 at 1:57
  • 1
    Beautiful! She will definitely learn and join Anyway, she will need it to write thesis LOL Oct 21, 2013 at 2:09
  • 3
    Ah Ah AAAAhhh! No words!
    – user11232
    Oct 21, 2013 at 5:44
  • 4
    Love is best expressed in three dimensions. Be careful, the bottom cusp is rather sharp (infinitely sharp, actually - don't touch it).
    – Thomas
    Oct 21, 2013 at 10:51
  • Beautiful plot! I added it to the PGFplots example gallery.
    – Stefan Kottwitz
    Mar 17, 2014 at 11:18
58

This may be cheesy and slightly off-topic, but here goes... Because my girlfriend's present still hadn't arrived on her birthday, I had to improvise; I made a coupon similar to the following, which she really liked. Perhaps that could give you ideas...

Of course, don't forget to buy her a real present. Most women don't like cheapskates :)

enter image description here

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{pgfornament}

\newcommand\mycoupon{%
    \begin{tikzpicture}[color=Maroon,
                        every node/.style={inner sep=0pt}]
     %\draw[help lines] (-6,-3) grid (6,3);
     \node[minimum width=12cm, minimum height=6cm](vecbox){};
     \draw[thin, gray!20]
          (vecbox.north west)
       -- (vecbox.north east)
       -- (vecbox.south east)
       -- (vecbox.south west)
       -- cycle;
     \node[anchor=north west] at (vecbox.north west)
          {\pgfornament[width=2cm]{61}};
     \node[anchor=north east] at (vecbox.north east)
          {\pgfornament[width=2cm,symmetry=v]{61}};
     \node[anchor=south west] at (vecbox.south west)
          {\pgfornament[width=2cm,symmetry=h]{61}};
     \node[anchor=south east] at (vecbox.south east)
          {\pgfornament[width=2cm,symmetry=c]{61}};
        \node at (0,0)
        {
            \LARGE
            \begin{tabular}{c}
            Coupon for one snuggle time\\
            with \textbf{Farticle Pilter}
            \end{tabular}
        };
        \node at (0,-2.7)
        {
            \tiny
            \begin{tabular}{c}
            Coupon redeemable by \textbf{insert name} only, whenever she wants.\\
            Issued on \textbf{insert date}. Does not expire\ldots{} ever!
            \end{tabular}
        };
    \end{tikzpicture}
}

\begin{document}

\pagestyle{empty}
\noindent
\mycoupon\\[1em]
\mycoupon\\[1em]
\mycoupon


\end{document}
4
  • 2
    dude it's sweet! Thanks! BTW, your advice on real present helps. haha! Oct 20, 2013 at 17:07
  • How fo I handle this error? ! LaTeX Error: File `pgfornament.sty' not found. Thanks! Oct 20, 2013 at 17:16
  • 1
    @perfectionm1ng You must install Alain Matthes's pgfornament package. I don't think it's part of any distribution yet. You can download it from there.
    – jub0bs
    Oct 20, 2013 at 17:19
  • Excellent and very simple to do apparently :-)
    – Sebastiano
    Jul 21, 2019 at 11:45
44

a beating heart ...

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-plot,multido}
\psset{algebraic,plotpoints=1000,unit=5,linewidth=10pt}
\begin{document}

\multido{\iA=20+20}{4}{%
  \begin{pspicture}(-1,-1.1)(1,0.8)
  \psparametricplot[linecolor=red!50,fillstyle=solid,
    fillcolor=red!\iA,linejoin=1]{0}{\psPiTwo}%
    {sin(t)^3 | (13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t))/16}
\end{pspicture}}

\end{document}

enter image description here

for the animation:

convert -delay 10 -loop 0 -density 300 -scale 300 -alpha remove heart.pdf heart.gif

And the same as a 3D cardioid:

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\multido{\iA=20+20,\iB=10+20,\iC=150+10}{4}{%
\begin{pspicture}(-4,-4)(4,4)% the main 2D area
\psset{lightsrc=viewpoint,viewpoint=50 -20 20 rtp2xyz,Decran=\iC}
\defFunction[algebraic]{heart}(u,v)
   { sin(u)^3*cos(v) }%                               x=f(u,v)
   { sin(u)^3*sin(v) }%                               y=f(u,v)
   { (13*cos(u)-5*cos(2*u)-2*cos(3*u)-cos(4*u))/16 }% z=f(u)
\psSolid[object=surfaceparametree,linecolor=red!\iB,
 base=0 pi pi 4 div neg 5 pi mul 2 div,
 fillcolor=red!\iA,function=heart,linewidth=0.1\pslinewidth,ngrid=40]
\end{pspicture}}

\end{document}

enter image description here

8
  • 19
    +1: I hope she does not suffer from epilepsy. By the way, pst-plot automatically loads multido. Oct 20, 2013 at 18:45
  • Cool! I like it a lot! Oct 21, 2013 at 2:09
  • 3
    no, I am so nervous that you may like it .... ;-)
    – user2478
    Oct 21, 2013 at 4:53
  • I am compiling it with XeLaTeX, texmaker. The heart is seperated into 4 pages, each page showing a static heart with one color. Any idea? Oct 21, 2013 at 7:00
  • see my edit, there is the command for creating the animated gif
    – user2478
    Oct 21, 2013 at 7:25
39

Here's a TikZing heart!

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
  \draw[red,fill=red] (0,0) .. controls (0,0.75) and (-1.5,1.00) .. (-1.5,2)  arc (180:0:0.75)  -- cycle;
  \draw[red,fill=red] (0,0) .. controls (0,0.75) and ( 1.5,1.00) .. ( 1.5,2)  arc (0:180:0.75) -- cycle;
\end{tikzpicture}
\end{document}

enter image description here

3
  • Nice! Simple and classic! Thanks! Where should I touch if I wanna make it bigger w.r.t. the A4 paper? Oct 20, 2013 at 17:37
  • You can pass x=2cm,y=2cm as an option to the tikzpicture environment.
    – A.Ellett
    Oct 20, 2013 at 17:46
  • @perfectionm1ng have a look at the standalone documentclass- it was made for images :)
    – cmhughes
    Oct 21, 2013 at 16:58
33

Unicode has many to choose from: xetex '\font\tenrm="Symbola:color=DD0000" at 3cm \rm ♥ ❤ ♡ \char"1F497\ \char"1F493\ \char"1F498 \bye'

enter image description here

2
  • I'm new. Any reason you're using XeTex rather than the standard LaTeX?
    – jvriesem
    Feb 8, 2014 at 8:31
  • 2
    @jvriesem: I rarely use LaTeX; when I need something so complicated that I think it's not worth the effort to do in plain XeTeX/LuaTeX, I go for ConTeXt. But note that you can do the same thing as in this example with XeLaTeX or LuaLaTeX: the only requirements are a Unicode-aware engine and a font which includes the glyphs. Though, you'd want to use an abstraction layer for the font-loading (ie. package fontspec) so you can use the features of LaTeX New Font Selection Scheme (NFSS). Oh, and warm welcome to tex.se! :-)
    – morbusg
    Feb 8, 2014 at 8:51
27

And then there's Knuth's METAFONT heart, adapted here for Metapost. See p.134 of the METAFONT book.

prologues := 3;
outputtemplate := "heart.eps";
beginfig(1);
path heart, p;
heart = (100,162) .. (140,178){right} .. (195,125){down}
     .. (100,0){curl 0} .. (100,0){curl 0} .. {up}(5,125) .. {right}(60,178) .. (100,162);
p = (100,200) -- (200,200) -- (200,100) -- (200,0) -- (0,0) -- (0,100) -- (0,200) -- (100,200);
for n=0 upto 10: draw interpath(n/10,p,heart) withcolor .987red; endfor
endfig;
end.

enter image description here

20

Joining late the party!!!

A very simple heart beat proposal with hobby and some shading:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{hobby,shadows}

\makeatletter
\pgfdeclareradialshading[tikz@ball]{heart}{\pgfpoint{-0.275cm}{0.4cm}}{%
  color(0cm)=(tikz@ball!60!white);
  color(0.4cm)=(tikz@ball!85!white); 
  color(0.7cm)=(tikz@ball); 
  color(0.9925cm)=(tikz@ball!75!black); 
  rgb(1cm)=(1,1,1)
}
\tikzoption{heart on color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{heart on}\tikz@addmode{\tikz@mode@shadetrue}}

\pgfdeclareradialshading[tikz@ball]{heart}{\pgfpoint{-0.275cm}{0.4cm}}{%
  color(0cm)=(tikz@ball!80!white);
  color(0.4cm)=(tikz@ball!90!white); 
  color(0.7cm)=(tikz@ball); 
  color(0.9925cm)=(tikz@ball!75!black); 
  rgb(1cm)=(1,1,1)
}
\tikzoption{heart color}{\pgfutil@colorlet{tikz@ball}{#1}\def\tikz@shading{heart}\tikz@addmode{\tikz@mode@shadetrue}}
\makeatother

% original code by Daniel:
% http://tex.stackexchange.com/questions/55806/tikzpicture-in-beamer#55849
\tikzset{
    invisible/.style={opacity=0,text opacity=0},
    visible on/.style={alt=#1{}{invisible}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} 
    },
}

% original code in
% http://tex.stackexchange.com/questions/84513/highlighting-in-beamer-using-tikz-nodes#84608
\tikzset{
  background shade/.style={#1},
  shade on/.style={alt=#1{}{background shade}},
  background shade/.default={shading=heart,heart color=red}
}

\begin{document}
\begin{frame}
\begin{tikzpicture}[scale=4]
\path[drop shadow,heart on color=red,shade on=<{2,4,6,8,9,12,13}>] 
(0,0) to[curve through={(0.25,0.4) .. (0.5,0.6) .. (0.5,1.2) .. (0.4,1.25)}]  (0,1) 
(0,1) to[curve through={(-0.4,1.25)..(-0.5,1.2) .. (-0.5,0.6).. (-0.25,0.4)}](0,0);
\end{tikzpicture}
\end{frame}
\end{document}

The result:

enter image description here

2
  • \draw[use Hobby shortcut] ([out angle=85,in angle=85]0,0) .. (1,0) .. ([Hobby finish]0,-2) .. ([out angle=95,in angle=95]-1,0) .. (0,0); Oct 22, 2013 at 11:42
  • @AndrewStacey: definitely more elegant :) But my twisted mind prefers coordinates... Oct 22, 2013 at 11:50
18
\documentclass{standalone}
\usepackage{arev}
\usepackage{xcolor}
\begin{document}
\rule[-2pt]{0pt}{10pt}
\textcolor{red}{$\varheart$}
\rule{0pt}{10pt}
\end{document}

heart

4
  • 1
    Red color with arrow missing otherwise perfect Oct 20, 2013 at 17:11
  • What's with the struts?
    – Werner
    Oct 20, 2013 at 17:11
  • The struts prevent standalone from chopping off the top of the heart; I tried without them and it looked even worse. Oct 20, 2013 at 17:13
  • \documentclass[preview,border=12pt]{standalone} \usepackage{arev} \usepackage{xcolor} \usepackage{graphicx} \begin{document} \scalebox{10}{\textcolor{red}{$\varheart$}} \end{document} is my suggestion. Oct 20, 2013 at 18:13
12

From TeXample.net, the author is Alain Matthes:

% Valentine heart
% Author: Alain Matthes
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \draw[ball color=BrickRed,shading=ball] (4,1) ..controls +(120:2cm)
        and +(90:2cm) .. (0,0) .. controls  +(-90:2cm) and +(90:3cm) ..
        (4,-8) .. controls +(90:3cm) and +(-90:2cm) ..(8,0)  .. controls
        +(90:2cm) and  +(60:2cm) .. (4,1);
\end{tikzpicture}
\end{document}

enter image description here

3

A very simple heart made with PGFPlots (compile twice):

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\definecolor{left}{HTML}{f00000}    % From https://tex.stackexchange.com/a/215917/152550

\begin{document}

\begin{tikzpicture}
    \begin{axis}[axis lines=none]
        \addplot[shading=axis,rectangle,left color=left,right color=left!30!white,shading angle=135,very thick,variable=t,domain=0:360,samples=150] ({16*sin(t)*sin(t)*sin(t)},{13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)});
    \end{axis}
\end{tikzpicture}

\end{document}

Heart

3

With a parametric curve in TikZ (rather than pgfplots) and without using controls

\documentclass[]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}%
\fill [red, thick,  domain=-200:200, samples=50] 
        plot ({ .67*sin(\x) * sin(\x) * sin(\x) + .5 }, 
              { .65 * cos(\x) - .2 * cos(2*\x) - .1 * cos(3*\x) - .05 * cos(4*\x) - .4 } );
\end{tikzpicture}
\end{document}

enter image description here

2

By means of a pgfplots code, I drew a plot using the formula of a heart. I have the formula from what is presented in this webpage, but I have changed some variables to make a nicer heart plot. Also, higher amounts of samples gives better

enter image description here

% pdflatex
\documentclass{standalone}
    \usepackage{tikz}
    \usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
       \pgfmathdeclarefunction{R}{1}{\pgfmathparse{(sin(deg(#1))*sqrt(abs(cos(deg(#1)))))/(sin(deg(#1))+8/5)-1.5*sin(deg(#1))+1.5}}
\begin{axis}
        [
        hide x axis,
        hide y axis,
        domain=-pi:pi,
        samples=1000,
        data cs=polarrad,
        ]
        \addplot [solid, thick,red,fill=red] {R(x)};
\end{axis}
\end{tikzpicture}
\end{document}

And if you are a heartbroken, you can draw this instead :D

enter image description here

% pdflatex
\documentclass{standalone}
    \usepackage{tikz}
    \usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
       \pgfmathdeclarefunction{R}{1}{\pgfmathparse{(sin(deg(#1))*sqrt(abs(cos(deg(#1)))))/(sin(deg(#1))+8/5)-1.5*sin(deg(#1))+1.5}}
\begin{axis}
        [
        hide axis,
        ]
        \addplot [domain=0:2*pi,samples=200,data cs=polarrad,solid, thick,red,fill=red,smooth] {R(x)};
        \addplot [domain=-0.5:1,samples=10,solid,very thick,black,fill=red,smooth] ({x-1},{1.25*x-2});
        \addplot [->,domain=1.968:2.5,samples=10,solid,very thick,black,fill=red,smooth] ({x-1},{1.25*x-2});
\end{axis}
\end{tikzpicture}
\end{document}
2

A minimalist π heart:

\documentclass[border=20,tikz]{standalone} 
\begin{document} 
\tikz\draw[rotate=90,very thick,domain=0:3.1416,smooth]
plot(\x r:\x*2) plot(-\x r:\x*2); 
\end{document}

mwe

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .