TeX - LaTeX Asked by Hatsuma on April 4, 2021
I am working on an automata and am trying to use textschwa or just schwa in math mode and all I end up getting is an ampersand. Anyone know how to achieve this in math mode? the code I am using is below, and the area I would like to place the schwa is in the matrix in edge (7). Thank you.
begin{tikzpicture}[shorten >=1pt,node distance=4cm,on grid,auto]
node[state] (0) {$q_0$};
node[state] (1) [below right=of 0] {$q_1$};
node[state] (2) [below left=of 1] {$q_2$};
node[state] (3) [below right=of 2] {$q_3$};
node[state] (4) [right=of 3] {$q_4$};
node[state] (5) [above right of=4] {$q_5$};
node[state] (6) [below right of=5] {$q_6$};
node[state] (7) [below left of=6] {$q_7$};
path[->]
(0) edge node {textschwa:R} (1)
(0) edge [loop above] node {B:textschwa} (0)
(1) edge node {textschwa:R} (2)
(1) edge [loop left] node {B:textschwa} (1)
(2) edge node {B:0:$R_2$} (3)
(3) edge node {B:0:$L_2$} (4)
(4) edge [loop above] node{1:R} (4)
(4) edge node {0:0} (5)
(5) edge [loop above] node{$begin{matrix}0:$R_2$1:$R_2$end{matrix}$} (5)
(5) edge [bend left] node{B:1:L} (6)
(6) edge [loop right] node{B:$L_2$} (6)
(6) edge [bend left] node{$x$:E:R} (5)
(6) edge node{textschwa:R} (7)
(7) edge [loop below] node{$begin{matrix}0:$R_2$1:$R_2$x:$R_2$ {textschwa}:$R_2$end{matrix}$} (7)
(7) edge node{B:0:$L_2$} (4)
end{tikzpicture}
Math font switching is a different mechanism than text font switching, as well as symbols being managed differently as well. textschwa
refers to the character ə as being character 64 (@
) in the ipa font which is why you're getting the unexpected character. The simplest route to get your result is to temporarily switch out of math mode to use the textschwa
e.g., mbox{textschwa}
. The alternative would be to take the harder route of defining a new math alphabet and declaring a command mathschwa
to allow the use of ə in math mode directly, but TeX's limitations on the number of math alphabets allowed makes this a less appealing option.
Correct answer by Don Hosek on April 4, 2021
Good question, but in the future, please include a MWE that compiles. I had to take my best guess what you meant here.
In LuaLaTeX or XeLaTeX, you can define textschwa
to use the Unicode character ə (U+0259). In PDFTeX, textschwa
is defined in the tipa
package.
If your font does not support the character, an alternative is rotatebox{180}{e}
, from the graphicx
package.
documentclass{article}
usepackage{iftex}
usepackage{tikz}
usetikzlibrary{automata,positioning}
iftutex
usepackage{unicode-math}
usepackage{newcomputermodern}
DeclareTextSymbol{textschwa}{UnicodeEncodingName}{"0259}
else
usepackage[T1]{fontenc}
usepackage{tipa}
usepackage{amsmath}
fi
newcommandmathschwa{mathalpha{textnormal{textschwa}}}
begin{document}
begin{tikzpicture}[shorten >=1pt,node distance=4cm,on grid,auto]
node[state] (0) {$q_0$};
node[state] (1) [below right=of 0] {$q_1$};
node[state] (2) [below left=of 1] {$q_2$};
node[state] (3) [below right=of 2] {$q_3$};
node[state] (4) [right=of 3] {$q_4$};
node[state] (5) [above right of=4] {$q_5$};
node[state] (6) [below right of=5] {$q_6$};
node[state] (7) [below left of=6] {$q_7$};
path[->]
(0) edge node {textschwa:R} (1)
(0) edge [loop above] node {B:textschwa} (0)
(1) edge node {textschwa:R} (2)
(1) edge [loop left] node {B:textschwa} (1)
(2) edge node {B:0:$R_2$} (3)
(3) edge node {B:0:$L_2$} (4)
(4) edge [loop above] node{1:R} (4)
(4) edge node {0:0} (5)
(5) edge [loop above] node{(begin{matrix}0:R_2 1: R_2 end{matrix})} (5)
(5) edge [bend left] node{B:1:L} (6)
(6) edge [loop right] node{B:$L_2$} (6)
(6) edge [bend left] node{$x$:E:R} (5)
(6) edge node{textschwa:R} (7)
(7) edge [loop below] node{(begin{matrix}0: R_2 1:R_2 x:R_2 {textschwa:R_2} end{matrix})} (7)
(7) edge node{B:0:$L_2$} (4);
end{tikzpicture}
end{document}
In this example, I didn’t appear to need a math-mode version, but {textnormal{textschwa}}
should work. If you wanted it italicized, you can try textit{textschwa}
or textnormal{itshapetextschwa}
.
Answered by Davislor on April 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP