首先:别忘了,就在140年前,艾尔伯特爱因斯坦出生;但就在一年前,史蒂芬·威廉·霍金去世了。这对科学来说是多么特别的一天啊!
问题
如何画字母 π不是以标准方式(即
\pi
)?
我的意思是“绘制”,而不是“键入”!今天不会有\pi
,但会有类似这样的内容
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,2)--(3,2);
\draw (1,0)--(1,2);
\draw (2,0)--(2,2);
\end{tikzpicture}
\end{document}
(灵感来自大卫·卡莱尔– 我在 Ti 中画了这个钾Z 只是因为我不知道如何使用picture
;))
或这个
\documentclass[tikz]{standalone}
\usepackage{tikzducks}
\begin{document}
\begin{tikzpicture}
\duck
\duck[xshift=1cm,yshift=2cm]
\duck[xshift=1cm,yshift=4cm]
\duck[xshift=1cm,yshift=6cm]
\duck[xshift=0cm,yshift=8cm]
\duck[xshift=-2cm,yshift=7.5cm]
\duck[xshift=2cm,yshift=8cm]
\duck[xshift=4cm,yshift=8cm]
\duck[xshift=6cm,yshift=8cm]
\duck[xshift=8cm,yshift=8cm]
\duck[xshift=5cm,yshift=6cm]
\duck[xshift=5cm,yshift=4cm]
\duck[xshift=5.5cm,yshift=2cm]
\duck[xshift=6.5cm,yshift=0cm]
\duck[xshift=8cm,yshift=1cm]
\node[font=\huge] at (4,11) {Happy $\pi$ day with \verb|tikzducks|!};
\end{tikzpicture}
\end{document}
它们是我最自豪的 π 画作,今天是圆周率日,我很想看看你的!
好吧,为什么我没有将提问时间延迟 8 分钟?我是在 UTC 时间 1:51:31 提问的,而今年的“圆周率秒”是今天 1:59:26!
答案1
以下是\shapepar
,非常感谢流框架。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage{shapepar}
\newcommand{\sep}{\discretionary{}{}{}}
\begin{document}
\small%
\shapepar[1.00375pt]{{137.821777}%
{0.0}b{27.0}%
\\{0.0}t{27.0}{249.0}%
\\{11.955168}t{14.0}{250.0}%
\\{23.910336}t{2.0}{249.0}%
\\{27.074219}t{0.0}{135.5}st{135.5}{111.5}%
\\{35.865504}t{57.0}{35.0}t{179.0}{35.0}%
\\{47.820672}t{56.0}{34.0}t{178.0}{34.0}%
\\{59.775841}t{55.0}{34.0}t{177.0}{34.0}%
\\{71.731009}t{53.0}{35.0}t{175.0}{35.0}%
\\{83.686177}t{52.0}{34.0}t{174.0}{34.0}%
\\{95.641345}t{51.0}{34.0}t{173.0}{34.0}%
\\{107.596513}t{49.0}{35.0}t{171.0}{35.0}%
\\{119.551681}t{48.0}{34.0}t{170.0}{34.0}%
\\{131.506849}t{47.0}{34.0}t{169.0}{34.0}%
\\{135.137695}t{46.0}{35.0}t{168.0}{35.0}%
\\{143.462017}t{45.0}{35.0}t{168.0}{34.0}%
\\{154.276367}t{44.0}{34.0}t{166.0}{35.0}%
\\{155.417186}t{44.0}{34.0}t{166.0}{35.0}%
\\{163.378906}t{43.0}{34.0}t{166.0}{34.0}%
\\{167.372354}t{43.0}{34.0}t{165.0}{35.0}t{256.0}{3.0}%
\\{171.936859}t{42.0}{34.0}t{165.0}{35.0}t{253.0}{8.0}%
\\{179.327522}t{41.0}{35.0}t{165.0}{35.0}t{248.0}{13.0}%
\\{182.050781}t{41.0}{34.0}t{165.0}{36.0}t{245.0}{15.0}%
\\{187.185547}t{40.0}{35.0}t{166.0}{36.0}t{240.0}{17.0}%
\\{191.28269}t{40.0}{34.0}t{166.0}{39.0}t{235.0}{19.0}%
\\{193.214996}t{40.0}{34.0}t{166.0}{40.0}t{232.0}{20.0}%
\\{197.688477}t{39.0}{35.0}t{167.0}{50.0}jt{217.0}{31.0}%
\\{198.388672}t{39.0}{35.0}t{167.0}{80.0}%
\\{203.237858}t{39.0}{34.0}t{169.0}{72.0}%
\\{207.880219}t{38.0}{34.0}t{171.0}{64.0}%
\\{207.958008}t{38.0}{34.0}t{171.0}{64.0}%
\\{215.193026}t{37.0}{19.0}t{175.0}{49.0}%
\\{215.660156}t{37.0}{18.0}t{176.0}{47.0}%
\\{222.195312}t{37.0}{2.0}t{186.0}{23.0}%
\\{222.195312}e{37.0}%
\\{223.362305}t{191.0}{13.0}%
\\{223.362305}e{191.0}%
}%
3\sep{}.\sep{}1\sep{}4\sep{}1\sep{}5\sep{}9\sep{}2\sep{}6\sep{}5\sep{}3\sep{}5\sep{}8\sep{}9\sep{}7\sep{}9\sep{}3\sep{}2\sep{}3\sep{}8\sep{}4\sep{}6\sep{}2\sep{}6\sep{}4\sep{}3\sep{}3\sep{}8\sep{}3\sep{}2\sep{}7\sep{}9\sep{}5\sep{}0\sep{}2\sep{}8\sep{}8\sep{}4\sep{}1\sep{}9\sep{}7\sep{}1\sep{}6\sep{}9\sep{}3\sep{}9\sep{}9\sep{}3\sep{}7\sep{}5\sep{}1\sep{}0\sep{}5\sep{}8\sep{}2\sep{}0\sep{}9\sep{}7\sep{}4\sep{}9\sep{}4\sep{}4\sep{}5\sep{}9\sep{}2\sep{}3\sep{}0\sep{}7\sep{}8\sep{}1\sep{}6\sep{}4\sep{}0\sep{}6\sep{}2\sep{}8\sep{}6\sep{}2\sep{}0\sep{}8\sep{}9\sep{}9\sep{}8\sep{}6\sep{}2\sep{}8\sep{}0\sep{}3\sep{}4\sep{}8\sep{}2\sep{}5\sep{}3\sep{}4\sep{}2\sep{}1\sep{}1\sep{}7\sep{}0\sep{}6\sep{}7\sep{}9\sep{}8\sep{}2\sep{}1\sep{}4\sep{}8\sep{}0\sep{}8\sep{}6\sep{}5\sep{}1\sep{}3\sep{}2\sep{}8\sep{}2\sep{}3\sep{}0\sep{}6\sep{}6\sep{}4\sep{}7\sep{}0\sep{}9\sep{}3\sep{}8\sep{}4\sep{}4\sep{}6\sep{}0\sep{}9\sep{}5\sep{}5\sep{}0\sep{}5\sep{}8\sep{}2\sep{}2\sep{}3\sep{}1\sep{}7\sep{}2\sep{}5\sep{}3\sep{}5\sep{}9\sep{}4\sep{}0\sep{}8\sep{}1\sep{}2\sep{}8\sep{}4\sep{}8\sep{}1\sep{}1\sep{}1\sep{}7\sep{}4\sep{}5\sep{}0\sep{}2\sep{}8\sep{}4\sep{}1\sep{}0\sep{}2\sep{}7\sep{}0\sep{}1\sep{}9\sep{}3\sep{}8\sep{}5\sep{}2\sep{}1\sep{}1\sep{}0\sep{}5\sep{}5\sep{}5\sep{}9\sep{}6\sep{}4\sep{}4\sep{}6\sep{}2\sep{}2\sep{}9\sep{}4\sep{}8\sep{}9\sep{}5\sep{}4\sep{}9\sep{}3\sep{}0\sep{}3\sep{}8\sep{}1\sep{}9\sep{}6\sep{}4\sep{}4\sep{}2\sep{}8\sep{}8\sep{}1\sep{}0\sep{}9\sep{}7\sep{}5\sep{}6\sep{}6\sep{}5\sep{}9\sep{}3\sep{}3\sep{}4\sep{}4\sep{}6\sep{}1\sep{}2\sep{}8\sep{}4\sep{}7\sep{}5\sep{}6\sep{}4\sep{}8\sep{}2\sep{}3\sep{}3\sep{}7\sep{}8\sep{}6\sep{}7\sep{}8\sep{}3\sep{}1\sep{}6\sep{}5\sep{}2\sep{}7\sep{}1\sep{}2\sep{}0\sep{}1\sep{}9\sep{}0\sep{}9\sep{}1\sep{}4\sep{}5\sep{}6\sep{}4\sep{}8\sep{}5\sep{}6\sep{}6\sep{}9\sep{}2\sep{}3\sep{}4\sep{}6\sep{}0\sep{}3\sep{}4\sep{}8\sep{}6\sep{}1\sep{}0\sep{}4\sep{}5\sep{}4\sep{}3\sep{}2\sep{}6\sep{}6\sep{}4\sep{}8\sep{}2\sep{}1\sep{}3\sep{}3\sep{}9\sep{}3\sep{}6\sep{}0\sep{}7\sep{}2\sep{}6\sep{}0\sep{}2\sep{}4\sep{}9\sep{}1\sep{}4\sep{}1\sep{}2\sep{}7\sep{}3\sep{}7\sep{}2\sep{}4\sep{}5\sep{}8\sep{}7\sep{}0\sep{}0\sep{}6\sep{}6\sep{}0\sep{}6\sep{}3\sep{}1\sep{}5\sep{}5\sep{}8\sep{}8\sep{}1\sep{}7\sep{}4\sep{}8\sep{}8\sep{}1\sep{}5\sep{}2\sep{}0\sep{}9\sep{}2\sep{}0\sep{}9\sep{}6\sep{}2\sep{}8\sep{}2\sep{}9\sep{}2\sep{}5\sep{}4\sep{}0\sep{}9\sep{}1\sep{}7\sep{}1\sep{}5\sep{}3\sep{}6\sep{}4\sep{}3\sep{}6\sep{}7\sep{}8\sep{}9\sep{}2\sep{}5\sep{}9\sep{}0\sep{}3\sep{}6\sep{}0\sep{}0\sep{}1\sep{}1\sep{}3\sep{}3\sep{}0\sep{}5\sep{}3\sep{}0\sep{}5\sep{}4\sep{}8\sep{}8\sep{}2\sep{}0\sep{}4\sep{}6\sep{}6\sep{}5\sep{}2\sep{}1\sep{}3\sep{}8\sep{}4\sep{}1\sep{}4\sep{}6\sep{}9\sep{}5\sep{}1\sep{}9\sep{}4\sep{}1\sep{}5\sep{}1\sep{}1\sep{}6\sep{}0\sep{}9\sep{}4\sep{}3\sep{}3\sep{}0\sep{}5\sep{}7\sep{}2\sep{}7\sep{}0\sep{}3\sep{}6\sep{}5\sep{}7\sep{}5\sep{}9\sep{}5\sep{}9\sep{}1\sep{}9\sep{}5\sep{}3\sep{}0\sep{}9\sep{}2\sep{}1\sep{}8\sep{}6\sep{}1\sep{}1\sep{}7\sep{}3\sep{}8\sep{}1\sep{}9\sep{}3\sep{}2\sep{}6\sep{}1\sep{}1\sep{}7\sep{}9\sep{}3\sep{}1\sep{}0\sep{}5\sep{}1\sep{}1\sep{}8\sep{}5\sep{}4\sep{}8\sep{}0\sep{}7\sep{}4\sep{}4\sep{}6\sep{}2\sep{}3\sep{}7\sep{}9\sep{}9\sep{}6\sep{}2\sep{}7\sep{}4\sep{}9\sep{}5\sep{}6\sep{}7\sep{}3\sep{}5\sep{}1\sep{}8\sep{}8\sep{}5\sep{}7\sep{}5\sep{}2\sep{}7\sep{}2\sep{}4\sep{}8\sep{}9\sep{}1\sep{}2\sep{}2\sep{}7\sep{}9\sep{}3\sep{}8\sep{}1\sep{}8\sep{}3\sep{}0\sep{}1\sep{}1\sep{}9\sep{}4\sep{}9\sep{}1\sep{}2\sep{}9\sep{}8\sep{}3\sep{}3\sep{}6\sep{}7\sep{}3\sep{}3\sep{}6\sep{}2\sep{}4\sep{}4\sep{}0\sep{}6\sep{}5\sep{}6\sep{}6\sep{}4\sep{}3\sep{}0\sep{}8\sep{}6\sep{}0\sep{}2\sep{}1\sep{}3\sep{}9\sep{}4\sep{}9\sep{}4\sep{}6\sep{}3\sep{}9\sep{}5\sep{}2\sep{}2\sep{}4\sep{}7\sep{}3\sep{}7\sep{}1\sep{}9\sep{}0\sep{}7\sep{}0\sep{}2\sep{}1\sep{}7\sep{}9\sep{}8\sep{}6\sep{}0\sep{}9\sep{}4\sep{}3\sep{}7\sep{}0\sep{}2\sep{}7\sep{}7\sep{}0\sep{}5\sep{}3\sep{}9\sep{}2\sep{}1\sep{}7\sep{}1\sep{}7\sep{}6\sep{}2\sep{}9\sep{}3\sep{}1\sep{}7\sep{}6\sep{}7\sep{}5\sep{}2\sep{}3\sep{}8\sep{}4\sep{}6\sep{}7\sep{}4\sep{}8\sep{}1\sep{}8\sep{}4\sep{}6\sep{}7\sep{}6\sep{}6\sep{}9\sep{}4\sep{}0\sep{}5\sep{}1\sep{}3\sep{}2\sep{}0\sep{}0\sep{}0\sep{}5\sep{}6\sep{}8\sep{}1\sep{}2\sep{}7\sep{}1\sep{}4\sep{}5\sep{}2\sep{}6\sep{}3\sep{}5\sep{}6\sep{}0\sep{}8\sep{}2\sep{}7\sep{}7\par
\end{document}
答案2
一些镶嵌图案的......
这一个是用平原完成的元帖子,因此用 进行编译mpost
。
prologues := 3;
outputtemplate := "%j%c.eps";
input colorbrewer-rgb;
beginfig(1);
path pi; numeric t; t = 13;
pi = (origin -- (5,0) -- (5,1) -- (4,1) -- (4,4) -- (3,4) -- (3,1) -- (2,1) -- (2,4) -- (1,4) -- (1,1) -- up -- cycle) scaled t;
for i=1 upto 48:
for j=1 upto 48:
fill pi shifted (4t*i-2t*j, t*i+5t*j) withcolor Spectral[7][i mod 7 + 1];
fill pi rotated 180 shifted (4t, 5t) shifted (4t*i-2t*j, t*i+5t*j) withcolor Spectral[7][(3+i) mod 7 + 1];
endfor
endfor
clip currentpicture to unitsquare scaled 100t shifted (0, 32t);
endfig;
end.
您需要加载Metapost 色彩酿造师对于颜色……
答案3
用 π 的数字写出 π——使用环境verbatim
。
\documentclass{article}
\linespread{0.7}
\begin{document}
\begin{verbatim}
3.141592653589793238462643383279
5028841971693993751058209749445923
07816406286208998628034825342117067
9821 48086 5132
823 06647 09384
46 09550 58223
17 25359 4081
2848 1117
4502 8410
2701 9385
21105 55964
46229 48954
9303 81964
4288 10975
66593 34461
284756 48233
78678 31652 71
2019091 456485 66
9234603 48610454326648
2133936 0726024914127
3724587 00660631558
817488 152092096
\end{verbatim}
\end{document}
基于 Jorel 的 ASCII 艺术绘画 -https://www.flickr.com/photos/jorel314/3352784321/
答案4
我们可以从字体中提取字形的 MetaPost 路径\pi
并使用 LuaTeX 绘制它。
\documentclass{article}
\usepackage{fontspec}
\setmainfont{latinmodern-math.otf}
\usepackage{luacode}
\begin{luacode*}
-- We need some utilities from ConTeXt
callbacks = callbacks or {}
callbacks.supported = callbacks.supported or {}
CONTEXTLMTXMODE = CONTEXTLMTXMODE or (status.obj_ptr == nil and 2 or 1)
dofile(kpse.find_file("util-fmt.lua"))
dofile(kpse.find_file("node-ini.lua"))
dofile(kpse.find_file("font-mps.lua"))
dofile(kpse.find_file("font-shp.lua"))
-- That's a simple reimplemetation of ConTeXt's \showshape macro
function outlinepaths(character)
local fontid = font.current()
local shapedata = fonts.hashes.shapes[fontid] -- by index
local chardata = fonts.hashes.characters[fontid] -- by unicode
local shapeglyphs = shapedata.glyphs or { }
character = utf.byte(character)
local c = chardata[character]
if c then
if not c.index then
return {}
end
local glyph = shapeglyphs[c.index]
if glyph and (glyph.segments or glyph.sequence) then
local units = shapedata.units or 1000
local factor = 100/units
local paths = fonts.metapost.paths(glyph,factor)
return paths
end
end
end
\end{luacode*}
\usepackage{luamplib}
\everymplib{beginfig(0);}
\everyendmplib{endfig;}
\def\mpdefineoutlines#1{\directlua{
local char = "\luaescapestring{#1}"
local outlines = outlinepaths("#1")
for i, path in ipairs(outlines) do
tex.print("fill " .. path .. ";")
end
}}
\begin{document}
\begin{mplibcode}
\mpdefineoutlines{