Last active
May 29, 2018 04:10
-
-
Save jimratliff/122ea9f399ef3bc8c6df13bd7c5ee90f to your computer and use it in GitHub Desktop.
jdrunicode package for LaTeX/Overleaf #latex #overleaf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| % | |
| % The jdrunicode package for LaTeX and Overleaf | |
| % | |
| % Author: Jim Ratliff | |
| % jim@jim-ratliff.name | |
| % May 4, 2018 | |
| % | |
| % Defines two commands: | |
| % | |
| % \jdrunicode | |
| % \jdrcircled | |
| % | |
| % Requires the fontspec package. | |
| % Therefore the document must be compiled either under XeLaTeX or LuaLaTeX. | |
| % | |
| % See https://gist.github.com/jimratliff/66099421cb09e422340ae98ce582486c for a test document of this package. | |
| \usepackage{fontspec} | |
| \usepackage{ifthen} | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| % \jdrunicode | |
| % | |
| % Takes a single argument | |
| % \jdrunicode{char}, where char is a unicode character | |
| % char may be the character itself, e.g., "⌘", or it may be the unicode code point | |
| % for the character using the \symbol command, e.g., | |
| % | |
| % \jdrunicode{⌘} \\ % Literal | |
| % \jdrunicode{\symbol{"2318}} \\ % Hexadecimal | |
| % \jdrunicode{\symbol{'21430}} \\ % Octal | |
| % \jdrunicode{\symbol{8984}} \\ % Decimal | |
| % | |
| % Returns char rendered in the font Symbola, a font that has glyphs for many | |
| % desired unicode characters. | |
| % Usage: | |
| % In many fonts, there are many characters (e.g., ⌘) do not exist in that font. | |
| % Use: \jdrunicode{⌘} to render that font in your document. | |
| % | |
| % Note: \jdrunicode was intended primarily for the use case in which the desired character | |
| % ⓐ is not available in the current font but | |
| % ⓑ can be more easily be typed directly by the user than by using its numeric code. | |
| % Otherwise, the \jdrunicode would have been written to internalize a call to the | |
| % \symbol command | |
| \newcommand{\jdrunicode}[1]{ {\fontspec{Symbola}#1} } | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END of \jdrunicode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| % \jdrcircled | |
| % | |
| % Takes a single argument. | |
| % Returns the "CIRCLED" unicode character corresponding to the argument, | |
| % when the argument is one of "1"–"10", "a"–"z", and "A"–"Z". | |
| % If the argument is some other character, returns that character wrapped | |
| % between "(…)". | |
| % For information about the characters returned, see Wikipedia, "Enclosed Alphanumerics," | |
| % https://en.wikipedia.org/wiki/Enclosed_Alphanumerics | |
| % Usage example: | |
| % \jdrcircled{c} | |
| % Results in: "Ⓒ" | |
| % \jdrcircled{*} | |
| % Results in "(*)" (because "*" is not among the alphanumeric characters for which | |
| % these circled characters are defined. | |
| % | |
| \newcommand{\jdrcircled}[1] | |
| { | |
| \ifthenelse{\equal{#1}{1}}{\jdrunicode{\symbol{"2460}}}{% | |
| \ifthenelse{\equal{#1}{2}}{\jdrunicode{\symbol{"2461}}}{% | |
| \ifthenelse{\equal{#1}{3}}{\jdrunicode{\symbol{"2461}}}{% | |
| \ifthenelse{\equal{#1}{4}}{\jdrunicode{\symbol{"2463}}}{% | |
| \ifthenelse{\equal{#1}{5}}{\jdrunicode{\symbol{"2464}}}{% | |
| \ifthenelse{\equal{#1}{6}}{\jdrunicode{\symbol{"2465}}}{% | |
| \ifthenelse{\equal{#1}{7}}{\jdrunicode{\symbol{"2466}}}{% | |
| \ifthenelse{\equal{#1}{8}}{\jdrunicode{\symbol{"2467}}}{% | |
| \ifthenelse{\equal{#1}{9}}{\jdrunicode{\symbol{"2468}}}{% | |
| \ifthenelse{\equal{#1}{10}}{\jdrunicode{\symbol{"2469}}}{% | |
| \ifthenelse{\equal{#1}{a}}{\jdrunicode{\symbol{"24D0}}}{% | |
| \ifthenelse{\equal{#1}{b}}{\jdrunicode{\symbol{"24D1}}}{% | |
| \ifthenelse{\equal{#1}{c}}{\jdrunicode{\symbol{"24D2}}}{% | |
| \ifthenelse{\equal{#1}{d}}{\jdrunicode{\symbol{"24D3}}}{% | |
| \ifthenelse{\equal{#1}{e}}{\jdrunicode{\symbol{"24D4}}}{% | |
| \ifthenelse{\equal{#1}{f}}{\jdrunicode{\symbol{"24D5}}}{% | |
| \ifthenelse{\equal{#1}{g}}{\jdrunicode{\symbol{"24D6}}}{% | |
| \ifthenelse{\equal{#1}{h}}{\jdrunicode{\symbol{"24D7}}}{% | |
| \ifthenelse{\equal{#1}{i}}{\jdrunicode{\symbol{"24D8}}}{% | |
| \ifthenelse{\equal{#1}{j}}{\jdrunicode{\symbol{"24D9}}}{% | |
| \ifthenelse{\equal{#1}{k}}{\jdrunicode{\symbol{"24DA}}}{% | |
| \ifthenelse{\equal{#1}{l}}{\jdrunicode{\symbol{"24DB}}}{% | |
| \ifthenelse{\equal{#1}{m}}{\jdrunicode{\symbol{"24DC}}}{% | |
| \ifthenelse{\equal{#1}{n}}{\jdrunicode{\symbol{"24DD}}}{% | |
| \ifthenelse{\equal{#1}{o}}{\jdrunicode{\symbol{"24DE}}}{% | |
| \ifthenelse{\equal{#1}{p}}{\jdrunicode{\symbol{"24DF}}}{% | |
| \ifthenelse{\equal{#1}{q}}{\jdrunicode{\symbol{"24E0}}}{% | |
| \ifthenelse{\equal{#1}{r}}{\jdrunicode{\symbol{"24E1}}}{% | |
| \ifthenelse{\equal{#1}{s}}{\jdrunicode{\symbol{"24E2}}}{% | |
| \ifthenelse{\equal{#1}{t}}{\jdrunicode{\symbol{"24E3}}}{% | |
| \ifthenelse{\equal{#1}{u}}{\jdrunicode{\symbol{"24E4}}}{% | |
| \ifthenelse{\equal{#1}{v}}{\jdrunicode{\symbol{"24E5}}}{% | |
| \ifthenelse{\equal{#1}{w}}{\jdrunicode{\symbol{"24E6}}}{% | |
| \ifthenelse{\equal{#1}{x}}{\jdrunicode{\symbol{"24E7}}}{% | |
| \ifthenelse{\equal{#1}{y}}{\jdrunicode{\symbol{"24E8}}}{% | |
| \ifthenelse{\equal{#1}{z}}{\jdrunicode{\symbol{"24E9}}}{% | |
| \ifthenelse{\equal{#1}{A}}{\jdrunicode{\symbol{"24B6}}}{% | |
| \ifthenelse{\equal{#1}{B}}{\jdrunicode{\symbol{"24B7}}}{% | |
| \ifthenelse{\equal{#1}{C}}{\jdrunicode{\symbol{"24B8}}}{% | |
| \ifthenelse{\equal{#1}{D}}{\jdrunicode{\symbol{"24B9}}}{% | |
| \ifthenelse{\equal{#1}{E}}{\jdrunicode{\symbol{"24BA}}}{% | |
| \ifthenelse{\equal{#1}{F}}{\jdrunicode{\symbol{"24BB}}}{% | |
| \ifthenelse{\equal{#1}{G}}{\jdrunicode{\symbol{"24BC}}}{% | |
| \ifthenelse{\equal{#1}{H}}{\jdrunicode{\symbol{"24BD}}}{% | |
| \ifthenelse{\equal{#1}{I}}{\jdrunicode{\symbol{"24BE}}}{% | |
| \ifthenelse{\equal{#1}{J}}{\jdrunicode{\symbol{"24BF}}}{% | |
| \ifthenelse{\equal{#1}{K}}{\jdrunicode{\symbol{"24C0}}}{% | |
| \ifthenelse{\equal{#1}{L}}{\jdrunicode{\symbol{"24C1}}}{% | |
| \ifthenelse{\equal{#1}{M}}{\jdrunicode{\symbol{"24C2}}}{% | |
| \ifthenelse{\equal{#1}{N}}{\jdrunicode{\symbol{"24C3}}}{% | |
| \ifthenelse{\equal{#1}{O}}{\jdrunicode{\symbol{"24C4}}}{% | |
| \ifthenelse{\equal{#1}{P}}{\jdrunicode{\symbol{"24C5}}}{% | |
| \ifthenelse{\equal{#1}{Q}}{\jdrunicode{\symbol{"24C6}}}{% | |
| \ifthenelse{\equal{#1}{R}}{\jdrunicode{\symbol{"24C7}}}{% | |
| \ifthenelse{\equal{#1}{S}}{\jdrunicode{\symbol{"24C8}}}{% | |
| \ifthenelse{\equal{#1}{T}}{\jdrunicode{\symbol{"24C9}}}{% | |
| \ifthenelse{\equal{#1}{U}}{\jdrunicode{\symbol{"24CA}}}{% | |
| \ifthenelse{\equal{#1}{V}}{\jdrunicode{\symbol{"24CB}}}{% | |
| \ifthenelse{\equal{#1}{W}}{\jdrunicode{\symbol{"24CC}}}{% | |
| \ifthenelse{\equal{#1}{X}}{\jdrunicode{\symbol{"24CD}}}{% | |
| \ifthenelse{\equal{#1}{Y}}{\jdrunicode{\symbol{"24CE}}}{% | |
| \ifthenelse{\equal{#1}{Z}}{\jdrunicode{\symbol{"24CF}}}{% | |
| % | |
| % If the argument of \jdrcircled is not recognized (i.e., not | |
| % one for which there is a definition, \jdrcircle returns | |
| % the argument itself wrapped in (…). | |
| % | |
| (#1) | |
| % | |
| % Each of the below string of "}"s terminates the "else" of one | |
| % the \ifthenelse statements above. Whenever an \ifthenelse | |
| % statement is added or subtracted above, a "}" must be added | |
| % or subtracted, respectively, below. | |
| }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END of \jdrcircled %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment