Adapting the answers to Good way to make \textcircled numbers? one could use an ellipse shape from tikz.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\newcommand*\compel[1]{\tikz[baseline=(char.base)]{
\node[ellipse,draw,inner sep=0.5pt] (char) {#1};}}
\begin{document}
\compel{x} \compel{\( x+y+z \)}
\end{document}

The cylinder shape is annoyingly close to your wish
\newcommand*\compcy[1]{\tikz[baseline=(char.base)]{
\node[cylinder,draw,inner sep=0.5pt] (char) {#1}; }}
\compcy{x} \compcy{\( x+y+z \)}

so one can go mad and try to adapt that code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\makeatletter
% Keys for shape flatcircle
%
% /pgf/shape aspect : Ratio between the x and y radii of the flatcircle end.
% /pgf/flatcircle uses custom fill : Use a custom fill for the flatcircle.
% /pgf/flatcircle end fill : Custom color for the flatcircle end.
% /pgf/flatcircle body fill : Custom color for the flatcirclebody.
%
\newif\ifpgfflatcircleusescustomfill
\pgfkeys{/pgf/.cd,
flatcircle uses custom fill/.is if=pgfflatcircleusescustomfill,
flatcircle end fill/.initial=white,
flatcircle body fill/.initial=white
}
\pgfdeclareshape{flatcircle}{%
\savedmacro\getflatcirclepoints{%
\pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/inner xsep}}%
\pgf@x\pgf@xc%
\advance\pgf@x.5\wd\pgfnodeparttextbox%
\pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/inner ysep}}%
\pgf@y\pgf@yc%
\advance\pgf@y.5\ht\pgfnodeparttextbox%
\advance\pgf@y.5\dp\pgfnodeparttextbox%
\ifpgfshapeborderusesincircle%
\pgfmathsetmacro\rotate{\pgfkeysvalueof{/pgf/shape border rotate}}%
\ifdim\pgf@x<\pgf@y%
\pgf@x\pgf@y%
\else%
\pgf@y\pgf@x%
\fi%
\pgf@x1.414213\pgf@x%
\pgf@y1.414213\pgf@y%
\else%
\pgfmathmod{\pgfkeysvalueof{/pgf/shape border rotate}}{360}%
\ifdim\pgfmathresult pt<0pt\relax%
\pgfmathadd@{\pgfmathresult}{360}%
\fi%
\pgfmathsetcount\c@pgf@counta{+\pgfmathresult}%
\advance\c@pgf@counta45\relax%
\divide\c@pgf@counta90\relax%
\multiply\c@pgf@counta90\relax%
\edef\rotate{\the\c@pgf@counta}%
\ifnum\c@pgf@counta=90\relax%
\pgf@xa\pgf@x%
\pgf@x\pgf@y%
\pgf@y\pgf@xa%
\pgf@yc\pgf@xc%
\else%
\ifnum\c@pgf@counta=270\relax%
\pgf@xa\pgf@x%
\pgf@x\pgf@y%
\pgf@y\pgf@xa%
\pgf@yc\pgf@xc%
\fi%
\fi%
\fi%
\addtosavedmacro\rotate%
\pgf@xa\pgf@x%
\pgf@ya\pgf@y%
\pgfutil@tempdima\pgfshapeaspect\pgf@ya%
\pgfutil@tempdimb\pgf@ya%
%
% Adjust for minimum height.
%
\pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum width}}%
\ifdim\pgfutil@tempdimb<.5\pgf@xc\relax%
\pgfutil@tempdimb.5\pgf@xc%
\pgf@ya\pgfutil@tempdimb%
\fi%
%
% Calculate how far the node contents can extend into the flatcircle bottom.
%
\pgf@yb\pgfutil@tempdimb%
\advance\pgf@yb-\pgf@yc%
\pgfmathdivide@{\pgfmath@tonumber{\pgf@yb}}{\pgfmath@tonumber{\pgfutil@tempdimb}}%
\pgfmathasin@{\pgfmathresult}%
\pgfmathcos@{\pgfmathresult}%
\let\angle\pgfmathresult%
\pgf@xb\pgfmathresult\pgfutil@tempdima%
%
% Adjust for minimum width.
%
\pgf@x.5\pgflinewidth%
\advance\pgf@x2.0\pgf@xa%
\advance\pgf@x3.0\pgfutil@tempdima%
\advance\pgf@x-\pgf@xb%
\pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/minimum height}}%
\ifdim\pgf@x<\pgf@xc%
\advance\pgf@xc-\pgf@x%
\advance\pgf@xa.5\pgf@xc%
\fi%
%
% Add the larger of the outer sep to the radii.
%
\pgf@x\pgfutil@tempdima\relax%
\pgf@y\pgfutil@tempdimb\relax%
\pgfmathsetlength\pgf@xc{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xc>\pgf@yc%
\advance\pgf@x\pgf@xc%
\advance\pgf@y\pgf@xc%
\edef\outersep{\the\pgf@xc}%
\else%
\advance\pgf@x\pgf@yc%
\advance\pgf@y\pgf@yc%
\edef\outersep{\the\pgf@yc}%
\fi%
\edef\xradius{\the\pgf@x}%
\edef\yradius{\the\pgf@y}%
\addtosavedmacro\xradius%
\addtosavedmacro\yradius%
\addtosavedmacro\outersep%
%
\pgfextract@process\flatcirclecenter{%
\pgf@x\pgfutil@tempdima%
\advance\pgf@x.5\pgflinewidth%
\advance\pgf@x\pgf@xb%
\pgf@x.5\pgf@x%
\pgf@y0pt%
}%
\addtosavedmacro\flatcirclecenter%
%
\pgfextract@process\beforetop{%
\pgf@x\pgf@xa%
\advance\pgf@x-\pgf@xb%
% \advance\pgf@x\pgfutil@tempdima%
% \advance\pgf@x.5\pgflinewidth%
\pgf@y\pgf@ya%
}%
\pgfextract@process\afterbottom{%
\pgf@x-\pgf@xa%
\advance\pgf@x\pgf@xb%
\pgf@y\pgf@ya%
}%
\addtosavedmacro\beforetop%
\addtosavedmacro\afterbottom%
\pgfmathsetlength\pgf@yc{\pgfkeysvalueof{/pgf/outer ysep}}%
\pgfextract@process\beforetopanchor{%
\beforetop%
\advance\pgf@y\pgf@yc%
}%
\pgfextract@process\afterbottomanchor{%
\afterbottom%
\advance\pgf@y\pgf@yc%
}%
\addtosavedmacro\beforetopanchor%
\addtosavedmacro\afterbottomanchor%
%
\beforetopanchor%
\advance\pgf@x\xradius\relax%
\ifdim\pgf@x>\pgf@y%
\edef\externalradius{\the\pgf@x}%
\else%
\edef\externalradius{\the\pgf@y}%
\fi%
\addtosavedmacro\externalradius%
}
\savedanchor\centerpoint{%
\pgf@x.5\wd\pgfnodeparttextbox%
\pgf@y.5\ht\pgfnodeparttextbox%
\advance\pgf@y-.5\dp\pgfnodeparttextbox%
}%
\savedanchor\midpoint{%
\pgf@x.5\wd\pgfnodeparttextbox%
\pgfmathsetlength\pgf@y{+0.5ex}%
}%
\savedanchor\basepoint{%
\pgf@x.5\wd\pgfnodeparttextbox%
\pgf@y0pt%
}%
\anchor{center}{\centerpoint}
\anchor{shape center}{%
\getflatcirclepoints%
\pgfmathrotatepointaround{\pgfpointadd{\flatcirclecenter}{\centerpoint}}%
{\centerpoint}{\rotate}%
}%
\anchor{mid}{\midpoint}%
\anchor{mid east}{%
\getflatcirclepoints%
\let\pgf@flatcircle@referencepoint\midpoint%
\pgf@anchor@flatcircle@border{\pgfqpoint{\externalradius}{0pt}}%
}%
\anchor{mid west}{%
\getflatcirclepoints%
\let\pgf@flatcircle@referencepoint\midpoint%
\pgf@anchor@flatcircle@border{\pgfqpoint{-\externalradius}{0pt}}%
}%
\anchor{base}{\basepoint}%
\anchor{base east}{%
\getflatcirclepoints%
\let\pgf@flatcircle@referencepoint\basepoint%
\pgf@anchor@flatcircle@border{\pgfqpoint{\externalradius}{0pt}}%
}%
\anchor{base west}{%
\getflatcirclepoints%
\let\pgf@flatcircle@referencepoint\basepoint%
\pgf@anchor@flatcircle@border{\pgfqpoint{-\externalradius}{0pt}}%
}%
\anchor{north}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{0pt}{\externalradius}}%
}%
\anchor{south}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{0pt}{-\externalradius}}%
}%
\anchor{east}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{\externalradius}{0pt}}%
}%
\anchor{west}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{-\externalradius}{0pt}}%
}%
\anchor{north east}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{\externalradius}{\externalradius}}%
}%
\anchor{south west}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{-\externalradius}{-\externalradius}}%
}%
\anchor{south east}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{\externalradius}{-\externalradius}}%
}%
\anchor{north west}{%
\getflatcirclepoints%
\pgf@anchor@flatcircle@border{\pgfqpoint{-\externalradius}{\externalradius}}%
}%
\anchor{before top}{%
\getflatcirclepoints%
\pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor}{\centerpoint}}{\centerpoint}{\rotate}%
}
\anchor{top}{%
\getflatcirclepoints%
\pgfmathrotatepointaround{%
\pgfpointadd{%
\beforetop%
\pgf@y0pt\relax%
\advance\pgf@x\xradius\relax%
}{\centerpoint}}{\centerpoint}{\rotate}%
}
\anchor{after top}{%
\getflatcirclepoints%
\pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}{\centerpoint}{\rotate}%
}
\anchor{before bottom}{%
\getflatcirclepoints%
\pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}{\centerpoint}{\rotate}%
}
\anchor{bottom}{%
\getflatcirclepoints%
\pgfmathrotatepointaround{%
\pgfpointadd{%
\afterbottom%
\pgf@y0pt\relax%
\advance\pgf@x-\xradius\relax%
}{\centerpoint}}{\centerpoint}{\rotate}%
}
\anchor{after bottom}{%
\getflatcirclepoints%
\pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor}{\centerpoint}}{\centerpoint}{\rotate}%
}
\backgroundpath{%
\getflatcirclepoints%
{%
\pgf@x\xradius\relax%
\advance\pgf@x-\outersep\relax%
\edef\xradius{\the\pgf@x}%
\pgf@y\yradius\relax%
\advance\pgf@y-\outersep\relax%
\edef\yradius{\the\pgf@y}%
\pgftransformshift{\centerpoint}%
\pgftransformrotate{\rotate}%
\pgfpathmoveto{\afterbottom}%
\pgfpatharc{90}{270}{\xradius and \yradius}%
\pgfpathlineto{\beforetop\pgf@y-\pgf@y}%
\pgfpatharc{-90}{90}{\xradius and \yradius}%
\pgfpathclose%
% \pgfpathmoveto{\beforetop}%
% \pgfpatharc{90}{270}{\xradius and \yradius}%
}%
}%
\behindbackgroundpath{%
\ifpgfflatcircleusescustomfill%
\getflatcirclepoints%
\pgf@x\xradius\relax%
\advance\pgf@x-\outersep\relax%
\edef\xradius{\the\pgf@x}%
\pgf@y\yradius\relax%
\advance\pgf@y-\outersep\relax%
\edef\yradius{\the\pgf@y}%
{%
\pgftransformshift{\centerpoint}%
\pgftransformrotate{\rotate}%
\pgfpathmoveto{\afterbottom}%
\pgfpatharc{90}{270}{\xradius and \yradius}%
\pgfpathlineto{\beforetop\pgf@y-\pgf@y}%
\pgfpatharc{270}{90}{\xradius and \yradius}%
\pgfpathclose%
\expandafter\pgfsetfillcolor\expandafter{\pgfkeysvalueof{/pgf/flatcircle body fill}}%
\pgfusepath{fill}%
%
\pgfpathmoveto{\beforetop}%
\pgfpatharc{90}{-270}{\xradius and \yradius}%
\pgfpathclose
\expandafter\pgfsetfillcolor\expandafter{\pgfkeysvalueof{/pgf/flatcircle end fill}}%
\pgfusepath{fill}%
}%
\fi%
}%
\anchorborder{%
\pgfextract@process\externalpoint{}%
\getflatcirclepoints%
\pgfutil@ifundefined{pgf@flatcircle@referencepoint}{\let\referencepoint\centerpoint}{%
\let\referencepoint\pgf@flatcircle@referencepoint}%
\pgfextract@process\externalpoint{%
\externalpoint%
\pgf@xa\pgf@x%
\pgf@ya\pgf@y%
\referencepoint%
\advance\pgf@x\pgf@xa%
\advance\pgf@y\pgf@ya%
}%
\pgfmathanglebetweenpoints{\centerpoint}{\externalpoint}%
\pgfmathsubtract@{\pgfmathresult}{\rotate}%
\ifdim\pgfmathresult pt<0pt\relax%
\pgfmathadd@{\pgfmathresult}{360}%
\fi%
\let\externalangle\pgfmathresult%
%
\pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\afterbottomanchor}{\centerpoint}}%
\ifdim\externalangle pt<\pgfmathresult pt\relax%
\pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\beforetopanchor}{\centerpoint}}%
\ifdim\externalangle pt<\pgfmathresult pt\relax%
\pgfmathrotatepointaround{%
\pgfmathpointintersectionoflineandarc%
{\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}%
{\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}%
{%
\beforetop%
\pgf@xa\pgf@x%
\centerpoint%
\advance\pgf@x\pgf@xa%
}%
{0}{90}{\xradius and \yradius}%
}{\centerpoint}{\rotate}%
\else%
\pgfpointintersectionoflines{%
\pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor}{\centerpoint}}%
{\centerpoint}{\rotate}}{%
\pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor}{\centerpoint}}%
{\centerpoint}{\rotate}}%
{\referencepoint}{\externalpoint}%
\fi%
\else%
\pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}%
\ifdim\externalangle pt>\pgfmathresult pt\relax%
\pgfmathanglebetweenpoints{\referencepoint}{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}%
\ifdim\externalangle pt>\pgfmathresult pt\relax%
\pgfmathrotatepointaround{%
\pgfmathpointintersectionoflineandarc%
{\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}%
{\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}%
{%
\beforetop%
\pgf@xa\pgf@x%
\centerpoint
\advance\pgf@x\pgf@xa%
}%
{270}{360}{\xradius and \yradius}%
}{\centerpoint}{\rotate}%
\else%
\pgfpointintersectionoflines{%
\pgfmathrotatepointaround{\pgfpointadd{\afterbottomanchor\pgf@y-\pgf@y}{\centerpoint}}%
{\centerpoint}{\rotate}}{%
\pgfmathrotatepointaround{\pgfpointadd{\beforetopanchor\pgf@y-\pgf@y}{\centerpoint}}%
{\centerpoint}{\rotate}}%
{\referencepoint}{\externalpoint}%
\fi%
\else%
\pgfmathrotatepointaround{%
\pgfmathpointintersectionoflineandarc%
{\pgfmathrotatepointaround{\externalpoint}{\centerpoint}{-\rotate}}%
{\pgfmathrotatepointaround{\referencepoint}{\centerpoint}{-\rotate}}%
{%
\afterbottom%
\pgf@xa\pgf@x%
\centerpoint
\advance\pgf@x\pgf@xa%
}%
{90}{270}{\xradius and \yradius}%
}{\centerpoint}{\rotate}%
\fi%
\fi%
}
}
\makeatother
\newcommand*\comp[1]{\tikz[baseline=(char.base)]{
\node[flatcircle,draw,inner ysep=1pt,inner xsep=0pt] (char) {#1};}}
\begin{document}
\comp{x} \comp{\( x+y+z \)} \comp{y} \comp{\( \int \)}
\end{document}

This is just the code from pgflibraryshapes.geometric.code.tex for the cylinder shape, with a few lines commented out. I have replaced cylinder by flatcircle throughout, commented out the lines that draw the leftward point half circle on the right of the cylinder, and in \pgfextract@process\beforetop commented out the shifting commands that moved the rightside of the cylinder to the right, and flipped the sign of a correction to \pgf@x by \pgf@xb. Finally, in calling this code setting the inner separations separately in the x and y directions, results in a round circle in the first case. The code is long, because it includes all the pgf material to set anchors, allow rotations etc.
arbgcbdare the same exactly. Of course, the circles can be centered at the math axis; just add\vcenter{\hbox{$in the first line of the definition of\comp@auxand$}}in the last line. – Heiko Oberdiek Aug 20 '12 at 11:15