Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For example, I want to put a circle around \land, just like one can put a circle around + by writing \oplus. Is there a general method to do this?

share|improve this question
5  
With \usepackage{stmaryrd} you can choose between \owedge and \varowedge. The former is lighter than the latter. Before building a symbol by hand, try and see if it's already available: see this answer. –  egreg Apr 29 '12 at 8:45
    
See also tex.stackexchange.com/questions/7032/… for a similar question with numbers instead of an operator. –  knut Sep 28 '13 at 19:22

4 Answers 4

Here's a version combining \land and \bigcirc:

\makeatletter
\newcommand\incircbin
{%
  \mathpalette\@incircbin
}
\newcommand\@incircbin[2]
{%
  \mathbin%
  {%
    \ooalign{\hidewidth$#1#2$\hidewidth\crcr$#1\bigcirc$}%
  }%
}
\newcommand{\oland}{\incircbin{\land}}
\makeatother

It will change size according to math style:

\[a\oland b\frac{a\oland b}{a\oland b^{a\oland b^{a\oland b}}}\] 

gives

oland example

share|improve this answer
    
There are unnecessary braces inside the \ooalign. I'd use \hidewidth rather than \hfil, but it's not so important, in this case. –  egreg Apr 29 '12 at 11:05
    
@egreg Thanks for the comment. Edited. –  Stephan Lehmke Apr 29 '12 at 11:36
1  
Your small symbols are not correct, circles seems to be ellipses ! –  Alain Matthes Apr 29 '12 at 12:07
    
@Altermundus Well that's what \bigcirc looks like at this style. Observe \land also changes proportion. I believe there is some bigger scheme behind this ;-) –  Stephan Lehmke Apr 29 '12 at 12:24

Update

More correct is the next code, I used the code from egreg here

\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage{tikz}

\newcommand{\circleland}{ 
  \mathbin{
    \mathchoice
      {\buildcircleland{\displaystyle}}
      {\buildcircleland{\textstyle}}
      {\buildcircleland{\scriptstyle}}
      {\buildcircleland{\scriptscriptstyle}}
  } 
}

\newcommand\buildcircleland[1]{%
  \begin{tikzpicture}[baseline=(X.base), inner sep=0, outer sep=0]
    \node[draw,circle] (X)  {$#1\land$};
  \end{tikzpicture}%
}

\begin{document}

\[a\circleland b\frac{a\circleland b}{a\circleland b^{a\circleland b^{a\circleland b}}}\]    

$x \circleland (y\circleland z)$ and  $x \land (y\land z)$     
\end{document} 

enter image description here

share|improve this answer
    
Apart from the abstract question "is this possible", is it really a good idea to make a math operator based on TikZ? As it's a basic logical operator, an average thesis or monograph in the field will contain several thousand instances of these. Add to that \mathchoice effects plus the fact that amsmath executes everything in an aligned environment twice, wouldn't this mean a lot of running time? Do you have experience with defining math operators with TikZ? Shouldn't this at least be solved with some caching in boxes? –  Stephan Lehmke Apr 29 '12 at 10:24
1  
Like egreg writes, the good way is to search inside "The Comprehensive LATEX Symbol List" ctan.org/tex-archive/info/symbols/comprehensive. Now for the running time, I don't know. It will be interesting to test. For the math operator with tikz, you can give a look at the excellent answer from egreg : tex.stackexchange.com/questions/46376/…. –  Alain Matthes Apr 29 '12 at 10:43
1  
egregs suggestion is applicable only if the symbol does indeed already exist. I'm interpreting the answers here as general advice on how to make a circled math operator. I just tested your symbol, and another issue is that it doesn't change size in \scriptstyle etc. –  Stephan Lehmke Apr 29 '12 at 10:56
    
I just made a small test with about 5000 symbols in one doc, and my version runs about 40 times faster than yours ;-) –  Stephan Lehmke Apr 29 '12 at 11:38
1  
Yes you are right \mathbin is a better option than \mathop and I corrected a bug with the limits. Yes you are also right with \mathchoice this macro is not very efficient ! –  Alain Matthes Apr 29 '12 at 13:09

You can use pgf for this purpose by defining a new command:

\newcommand{\circleland}{
\tikz{
\pgfsetbaselinepointlater{\pgfpointanchor{X}{base}}
\pgfcircle{\pgfpointorigin}{0.15cm}
\pgfusepath{stroke}
\node (X) {$\land$};
}}

Look at this MWE:

\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage{tikz}

\newcommand{\circleland}{
\tikz{
\pgfsetbaselinepointlater{\pgfpointanchor{X}{base}}
\pgfcircle{\pgfpointorigin}{0.15cm}
\pgfusepath{stroke}
\node (X) {$\land$};
}}
\begin{document}
\[x \land y\]

\begin{equation}
x \circleland y
\end{equation}

\end{document} 

the result will be:

enter image description here

share|improve this answer
1  
I suggest using inner sep/outer sep=0pt and use the command \mathop to get the correct spacing. –  Marco Daniel Apr 29 '12 at 8:55

I spent some time trying to get the <,<=,=,>= and > operators circled nicely. Code ended up a bit hacky, even though it worked:

<

\Large \textcircled{\normalsize \$\hspace{0.05 mm} &lt;\$} \normalsize

<=

\Large \textcircled{\raisebox{1pt} {\normalsize \$\hspace{0.05 mm} \leq\$}} \normalsize

=

\Large \textcircled{\raisebox{1pt} {\normalsize \$\hspace{0.05 mm} =\$}} \normalsize

>=

\Large \textcircled{\raisebox{1pt} {\normalsize \$\hspace{0.1 mm} \geq\$}} \normalsize

>

\Large \textcircled{\normalsize \$\hspace{0.1 mm} &gt;\$} \normalsize

The horizontal spacings are quite finicky. It ended up looking like this (center column):

Big O table

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.