我希望能够围绕某个表达式画一条线。到目前为止,我已经找到了如何在表达式周围画一个圆圈,但我想知道是否有可能画一个不太受限的形状(椭圆,圆角矩形,任何具有良好规律性的封闭曲线)。
我目前所做的
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath, amssymb}
\usepackage{mathrsfs}
\usepackage{tikz}
\usepackage[shortlabels]{enumitem}
% ---------------------------------------- %
% 15/05/19 %
\def\dsp{\displaystyle}
\def\ssk{\smallskip}
\def\Objet{\textrm{Objet}}
\def\Prop{\textrm{Prop}}
\newcommand{\gives}[2]{\left. \begin{array}{l} #1\end{array}\right | \!\! \raisebox{1mm}{\rule{2ex}{0.4pt}}\ #2}
% ---------------------------------------- %
\makeatletter
\newcommand\mathcircled[1]{%
\mathpalette\@mathcircled{#1}%
}
\newcommand\@mathcircled[2]{%
\tikz[baseline=(math.base)] \node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$};%
}
\makeatother
% ---------------------------------------- %
\newcommand{\ofType}{\,{\boldsymbol{:}}\,}
% ---------------------------------------- %
\begin{document}
\subsection*{Objets}
\begin{enumerate}[1., font = \bfseries]
\item \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{x,y}\ofType\Objet}$
\item[1'.] \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{\Pi(x,y)}\ofType\Objet}$
\item[1''.] \ \\
$\gives{A\ofType\Objet \\ X\ofType\mathcircled{A\to{}\Objet}}{\mathcircled{\dsp\prod_{a:A}X(a)}\ofType\Objet}$
\item \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{x\to{}y}\ofType\Objet}$
\item \ \\
$\gives{
x\ofType X \\
f\ofType\mathcircled{X\to{}Y}}{f(x)\ofType Y}$
\item \ \\
$\gives{
f\ofType\mathcircled{X\to{}Y} \\
g\ofType\mathcircled{Y\to{}Z}}{\mathcircled{g\circ f}\ofType \mathcircled{X\to{}Z}}$
\item \ \\
$\gives{
x\ofType\Objet \\
y\ofType\Objet}{\mathcircled{x=y}\ofType \Prop}$
\item \ \\
$\gives{
x\ofType X \\
f\ofType\mathcircled{X\to{}Y} \\
g\ofType\mathcircled{Y\to{}Z}}{\textrm{def}_{g \circ f, x}\ofType\mathcircled{\mathcircled{g\circ f}(x) = g(f(x))}}$
\end{enumerate}
\end{document}
我想画什么
这看上去就像是我想要画的东西。
答案1
选择你喜欢的。
椭圆
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath, amssymb}
\usepackage{mathrsfs}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage[shortlabels]{enumitem}
% ---------------------------------------- %
% 15/05/19 %
\def\dsp{\displaystyle}
\def\ssk{\smallskip}
\def\Objet{\textrm{Objet}}
\def\Prop{\textrm{Prop}}
\newcommand{\gives}[2]{\left. \begin{array}{l} #1\end{array}\right | \!\! \raisebox{1mm}{\rule{2ex}{0.4pt}}\ #2}
% ---------------------------------------- %
\makeatletter
\newcommand\mathcircled[1]{%
\mathpalette\@mathcircled{#1}%
}
\newcommand\@mathcircled[2]{%
\tikz[baseline=(math.base)] {
\node[draw,ellipse,inner sep=1pt] (math) {$\m@th#1#2$};
\path ([yshift=-1pt]math.south);
\path ([yshift=1pt]math.north);
}%
}
\makeatother
% ---------------------------------------- %
\newcommand{\ofType}{\,{\boldsymbol{:}}\,}
% ---------------------------------------- %
\begin{document}
\subsection*{Objets}
\begin{enumerate}[1., font = \bfseries]
\item \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{x,y}\ofType\Objet}$
\item[1'.] \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{\Pi(x,y)}\ofType\Objet}$
\item[1''.] \ \\
$\gives{A\ofType\Objet \\ X\ofType\mathcircled{A\to{}\Objet}}{\mathcircled{\dsp\prod_{a:A}X(a)}\ofType\Objet}$
\item \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{x\to{}y}\ofType\Objet}$
\item \ \\
$\gives{
x\ofType X \\
f\ofType\mathcircled{X\to{}Y}}{f(x)\ofType Y}$
\item \ \\
$\gives{
f\ofType\mathcircled{X\to{}Y} \\
g\ofType\mathcircled{Y\to{}Z}}{\mathcircled{g\circ f}\ofType \mathcircled{X\to{}Z}}$
\item \ \\
$\gives{
x\ofType\Objet \\
y\ofType\Objet}{\mathcircled{x=y}\ofType \Prop}$
\item \ \\
$\gives{
x\ofType X \\
f\ofType\mathcircled{X\to{}Y} \\
g\ofType\mathcircled{Y\to{}Z}}{\textrm{def}_{g \circ f, x}\ofType\mathcircled{\mathcircled{g\circ f}(x) = g(f(x))}}$
\end{enumerate}
\end{document}
圆角矩形
我必须增加inner sep
。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath, amssymb}
\usepackage{mathrsfs}
\usepackage{tikz}
\usepackage[shortlabels]{enumitem}
% ---------------------------------------- %
% 15/05/19 %
\def\dsp{\displaystyle}
\def\ssk{\smallskip}
\def\Objet{\textrm{Objet}}
\def\Prop{\textrm{Prop}}
\newcommand{\gives}[2]{\left. \begin{array}{l} #1\end{array}\right | \!\! \raisebox{1mm}{\rule{2ex}{0.4pt}}\ #2}
% ---------------------------------------- %
\makeatletter
\newcommand\mathcircled[1]{%
\mathpalette\@mathcircled{#1}%
}
\newcommand\@mathcircled[2]{%
\tikz[baseline=(math.base)] {
\node[draw,rounded corners,inner sep=3pt] (math) {$\m@th#1#2$};%
\path ([yshift=-1.5pt]math.south);
\path ([yshift=1.5pt]math.south);
}
}
\makeatother
% ---------------------------------------- %
\newcommand{\ofType}{\,{\boldsymbol{:}}\,}
% ---------------------------------------- %
\begin{document}
\subsection*{Objets}
\begin{enumerate}[1., font = \bfseries]
\item \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{x,y}\ofType\Objet}$
\item[1'.] \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{\Pi(x,y)}\ofType\Objet}$
\item[1''.] \ \\
$\gives{A\ofType\Objet \\ X\ofType\mathcircled{A\to{}\Objet}}{\mathcircled{\dsp\prod_{a:A}X(a)}\ofType\Objet}$
\item \ \\
$\gives{x\ofType\Objet \\ y\ofType\Objet}{\mathcircled{x\to{}y}\ofType\Objet}$
\item \ \\
$\gives{
x\ofType X \\
f\ofType\mathcircled{X\to{}Y}}{f(x)\ofType Y}$
\item \ \\
$\gives{
f\ofType\mathcircled{X\to{}Y} \\
g\ofType\mathcircled{Y\to{}Z}}{\mathcircled{g\circ f}\ofType \mathcircled{X\to{}Z}}$
\item \ \\
$\gives{
x\ofType\Objet \\
y\ofType\Objet}{\mathcircled{x=y}\ofType \Prop}$
\item \ \\
$\gives{
x\ofType X \\
f\ofType\mathcircled{X\to{}Y} \\
g\ofType\mathcircled{Y\to{}Z}}{\textrm{def}_{g \circ f, x}\ofType\mathcircled{\mathcircled{g\circ f}(x) = g(f(x))}}$
\end{enumerate}
\end{document}