我在一本美国教科书中看到过一个洋红色的符号,它出现在一个练习的编号附近,我非常喜欢这个练习,它代表了笛卡尔参考系中一个函数的通用图形。
我做了一些研究,但我认为没有任何包可以在没有的情况下生成此符号TikZ-pgf
。这是我的 MWE,没有将曲线插入网格。
\documentclass[a4paper,12pt]{article}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{relsize}
\begin{document}
$\textcolor{magenta}{\mathlarger{\boxplus}}$
\end{document}
我还没有找到可以与符号重叠的曲线符号。
答案1
您可以使用pict2e
:
\documentclass{article}
\usepackage{xcolor,pict2e}
\newcommand{\usegraph}{%
\begingroup\setlength{\unitlength}{0.16pt}%
\begin{picture}(100,100)
\color{magenta}
\polygon(0,0)(100,0)(100,100)(0,100)
\Line(50,0)(50,100)
\Line(0,50)(100,50)
\cbezier(0,0)(60,200)(40,0)(100,100)
\end{picture}%
\endgroup
}
\begin{document}
\usegraph
\end{document}
曲线更粗的版本:
\documentclass{article}
\usepackage{xcolor,pict2e}
\newcommand{\usegraph}{%
\begingroup\setlength{\unitlength}{0.16pt}%
\begin{picture}(100,100)
\color{magenta}
\polygon(0,0)(100,0)(100,100)(0,100)
\Line(50,0)(50,100)
\Line(0,50)(100,50)
\linethickness{0.8pt}
\cbezier(1,0)(60,200)(40,0)(99,100)
\end{picture}%
\endgroup
}
\begin{document}
\usegraph
\end{document}
使用(相当新的)l3draw
包装。
\documentclass{article}
\usepackage{xparse,l3draw,xcolor}
\ExplSyntaxOn
\NewDocumentCommand{\usegraph}{O{16pt}}
{
\raisebox{0pt}[#1][0pt]{\color{magenta}\egreg_usegraph:n { #1 }}
}
\dim_new:N \l__egreg_usegraph_size_dim
\cs_new_protected:Nn \egreg_usegraph:n
{
\dim_set:Nn \l__egreg_usegraph_size_dim { #1 }
\draw_begin:
\draw_linewidth:n { 0.025*(#1) }
\draw_path_moveto:n { 0\l__egreg_usegraph_size_dim , 0\l__egreg_usegraph_size_dim }
\draw_path_lineto:n { 1\l__egreg_usegraph_size_dim , 0\l__egreg_usegraph_size_dim }
\draw_path_lineto:n { 1\l__egreg_usegraph_size_dim , 1\l__egreg_usegraph_size_dim }
\draw_path_lineto:n { 0\l__egreg_usegraph_size_dim , 1\l__egreg_usegraph_size_dim }
\draw_path_close:
\draw_path_use_clear:n { stroke }
\draw_path_moveto:n { 0.5\l__egreg_usegraph_size_dim , 0\l__egreg_usegraph_size_dim }
\draw_path_lineto:n { 0.5\l__egreg_usegraph_size_dim , 1\l__egreg_usegraph_size_dim }
\draw_path_use_clear:n { stroke }
\draw_path_moveto:n { 0\l__egreg_usegraph_size_dim , 0.5\l__egreg_usegraph_size_dim }
\draw_path_lineto:n { 1\l__egreg_usegraph_size_dim , 0.5\l__egreg_usegraph_size_dim }
\draw_path_use_clear:n { stroke }
\draw_linewidth:n { 0.05*(#1) }
\draw_path_moveto:n { 0.01\l__egreg_usegraph_size_dim , 0\l__egreg_usegraph_size_dim }
\draw_path_curveto:nnn
{ 0.6\l__egreg_usegraph_size_dim , 2\l__egreg_usegraph_size_dim }
{ 0.4\l__egreg_usegraph_size_dim , 0\l__egreg_usegraph_size_dim }
{ 0.99\l__egreg_usegraph_size_dim , 1\l__egreg_usegraph_size_dim }
\draw_path_use_clear:n { stroke }
\draw_end:
}
\ExplSyntaxOff
\begin{document}
\usegraph\quad\usegraph[1em]\quad\usegraph[30pt]
\end{document}