creating custom symbol

76 views
Skip to first unread message

caramelizedonions

unread,
Jul 23, 2016, 12:17:07 PM7/23/16
to MathJax Users
Hi,

I apologize in advance if this qualifies as an annoying question, but I would like to create a custom relation symbol in MathJax---in my case a colon ":" with hollow dots, instead of full dots.

Any ideas how to achieve this? I've had a great time using MathJax but I'm still a newbie and I thought I would ask here before reinventing the wheel (or failing while trying).

Thanks!

Peter Krautzberger

unread,
Jul 23, 2016, 1:10:16 PM7/23/16
to mathja...@googlegroups.com

Hi,

Quick and dirty might be

\substack{\small \circle \\ \small \circle}

But perhaps there are cleaner solutions.

Regards,
Peter.


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William F Hammond

unread,
Jul 23, 2016, 2:03:25 PM7/23/16
to mathja...@googlegroups.com

On Sat, Jul 23, 2016 at 9:17 AM, caramelizedonions <jpst...@gmail.com> wrote:

I apologize in advance if this qualifies as an annoying question, but I would like to create a custom relation symbol in MathJax---in my case a colon ":" with hollow dots, instead of full dots.

Would ⦂ be what you want?   (It's U+2982)

caramelizedonions

unread,
Jul 23, 2016, 2:24:49 PM7/23/16
to MathJax Users
@Peter: 

The "quick and dirty" solution looks pretty good! The hollow dots are about the right size!

I would just like to raise it up a little... would there be any way to achieve that? (I'd also like to get the dots a bit closer together, but this is not as important as the overall vertical alignment.)

@William: 

Was not aware of that symbol, but those dots look too close together compared to the standard colon, at first glance. Would still like to test it on my own page though. How do I access this character in mathjax? (Am not used to working with unicode, sorry.)

David Farmer

unread,
Jul 23, 2016, 2:39:05 PM7/23/16
to MathJax Users

I think this is how you use the unicode character:

\def\myrelation{\unicode{x2982}}

caramelizedonions

unread,
Jul 23, 2016, 2:48:20 PM7/23/16
to MathJax Users
Thank you. "\unicode{x2982}" does post the unicode character, but those dots are ultimately too close together.

Peter's solution is pretty good, but I would like to tweak the vertical alignment...


On Saturday, July 23, 2016 at 6:17:07 PM UTC+2, caramelizedonions wrote:

Davide Cervone

unread,
Jul 23, 2016, 3:40:13 PM7/23/16
to mathja...@googlegroups.com
To raise the dots, try

\raise.15ex{\substack{\small\circ \\ \small\circ}}}

To make it a relation (with the spacing of a relation) use

\mathrel{\raise.15ex{\substack{\small \circ \\ \small \circ}}}}

If you go with the unicode character, you can use

\mathrel{\unicode{x2982}}

but be aware that this relies on your users having a font that includes this character and that the browser can access it.  That varies from system to system and browser to browser.

Davide


William F Hammond

unread,
Jul 23, 2016, 3:43:39 PM7/23/16
to mathja...@googlegroups.com

On Sat, Jul 23, 2016 at 11:24 AM, caramelizedonions <jpst...@gmail.com> wrote:

Was not aware of that symbol, but those dots look too close together compared to the standard colon, at first glance. Would still like to test it on my own page though. How do I access this character in mathjax? (Am not used to working with unicode, sorry.)

You may enter it as an HTML character entity: &#x2982;  See my experimentation at
http://math.albany.edu/~hammond/demos/hollowColon.html

William F Hammond

unread,
Jul 23, 2016, 4:09:27 PM7/23/16
to mathja...@googlegroups.com

On Sat, Jul 23, 2016 at 12:40 PM, Davide Cervone <dpv...@gmail.com> wrote:

but be aware that this relies on your users having a font that includes this character and that the browser can access it.  That varies from system to system and browser to browser.

One can reduce that concern to the concern that the reading user has a browser supporting webfonts if one serves a suitable webfont.  This example offers Latin Modern, which does include U+2982:
http://math.albany.edu/~hammond/demos/hollowColon-lm.html

jpst...@gmail.com

unread,
Jul 23, 2016, 7:07:45 PM7/23/16
to MathJax Users, jpst...@gmail.com
In the end I'm using this macro (close to David's modification of Peter's idea):

holcol: "\\!\\rt{0.1}\\mathrel{\\raise.15ex{\\substack{\\small \\circ \\\\ \\small \\circ}}}"

I'm using STIX fonts... pretty sure... and this looked best, compared to the unicode options. (If one zooms in the colon looks too high, now, but without zoom this is what looks right on my screen.) If I switch to the TeX webfont it looks pretty bad, but so far I'm happy with STIX.

Thanks again!

PS: "\rt{0.1}" is my own macro for moving something to the right by 0.1em:

rt:  ["\\Rule{#1em}{0pt}{0em}", 1]

(I've probably just embarrassed myself because there's a built-in way to do that with hspace or whatever. Oh well...)

On Saturday, July 23, 2016 at 6:17:07 PM UTC+2, caramelizedonions wrote:

Davide Cervone

unread,
Jul 25, 2016, 10:36:51 AM7/25/16
to mathja...@googlegroups.com, jpst...@gmail.com
> PS: "\rt{0.1}" is my own macro for moving something to the right by 0.1em:
>
> rt: ["\\Rule{#1em}{0pt}{0em}", 1]
>
> (I've probably just embarrassed myself because there's a built-in way to do that with hspace or whatever. Oh well…)

Yes, you can use \hspace{.1em} or \hskip .1em, and either would be preferable to the rule. You could also incorporate the backspace into the value and not have two skips in a row. I’m not sure what the skips are for anyway, as the spacing difference is very small, and it is not generally a good idea to do finicky spacing tweaks like this.

Also, if you think the zoomed version is too high, use a smaller value than .15ex (I just eyeballed that as an example, and didn’t test it at difference sizes).

Davide

caramelizedonions

unread,
Jul 26, 2016, 4:38:58 AM7/26/16
to MathJax Users
Thank you Davide, duly noted.

(And big thanks to William, by the way, for the thorough experimentation :) )
Reply all
Reply to author
Forward
0 new messages