How can I print a \rightarrow
or \Rightarrow
(I really don't care, I just want an arrow…) without the following words being in italics? This sentence added for grammar control.
[Tex/LaTex] Right arrow without italics
arrowsfontsitalic
Related Solutions
Another option would be to use TikZ to define an \xrightarrowtail
macro:
\documentclass{amsart}
\usepackage{tikz}
\makeatletter
\newbox\xrat@below
\newbox\xrat@above
\newcommand{\xrightarrowtail}[2][]{%
\setbox\xrat@below=\hbox{\ensuremath{\scriptstyle #1}}%
\setbox\xrat@above=\hbox{\ensuremath{\scriptstyle #2}}%
\pgfmathsetlengthmacro{\xrat@len}{max(\wd\xrat@below,\wd\xrat@above)+.6em}%
\mathrel{\tikz [>->,baseline=-.75ex]
\draw (0,0) -- node[below=-2pt] {\box\xrat@below}
node[above=-2pt] {\box\xrat@above}
(\xrat@len,0) ;}}
\makeatother
\begin{document}
\[ f : G \xrightarrowtail[{\star}]{\text{\textbf{Grp}}} H \]
\end{document}
This produces the output
(The amsart
document class is only used to get \text
, and not used in the macro definition.)
Edit: I realize I should probably explain what's going on here. It's not too complicated: we allocate boxes \xrat@below
and \xrat@above
to store the text we're going to place above and below, and we fill them with our arguments set as script-style math. We then set \xrat@len
, which will be the arrow length, to the larger of the two widths plus .6 ems for padding on either side. We then simply draw the arrow, placing the below box below and above box below. It's worth noting that the values in +.6em
, baseline=.75ex
, below=-2pt
, and above=-2pt
are all completely arbitrary, and result from me tinkering briefly; changing them might give better results for your use case. The baseline
option moved the arrow up to the middle, instead of having it trail along the ground, and the below
and above
options set the text closer to the arrow, which is desired in this context.
A better solution would probably be to figure out how to use Strike that, this would require the missing amsmath
's \ext@arrow
command (which it uses to define \xleftarrow
and \xrightarrow
, and which other packages for similar commands seem to use as well), but I can't figure out how it works.\arrowtail
(>--
) macro which you were asking about in the first place (since extpfeil
uses \ext@arrow
under the hood as well). I suppose the best bet might be to create such a character in Metafont or some such, but I'm not sure how to do that.
You have to use remember picture in the options of n1
and t1
like
\tikz[remember picture] \node[coordinate] (n1) {};
Code:
\documentclass{beamer} %
\usetheme{CambridgeUS}
\usepackage[latin1]{inputenc}
\usefonttheme{professionalfonts}
\usepackage{times}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}
\author{Author}
\title{Presentation title}
\begin{document}
\frame{
\frametitle{MATERIAL IN THE UNIVERSE}
\framesubtitle{Simulations need to account for the full cosmic matter-energy content}
\begin{block}{Main ingredients of the Universe:}
\begin{itemize}
\item Dark Energy \hspace{16.3 mm} $\Rightarrow $ expansion, $a(t)$
\item Dark Matter \hspace{16.3 mm} $\Rightarrow $ collisionless fluid, interacting \\ \hspace{68 mm} via gravity
\item Baryonic Matter (`gas') $\Rightarrow $ \tikz[baseline,remember picture]{\node[fill=green!20,anchor=base] (t1){(magneto)hydrodynamic};},\\ \hspace{68 mm} self-gravity
\end{itemize}
\begin{itemize}[<+-| alert@+>]
\item that is actually not enough, we need to include sub-resolution physics (cooling, star formation, feedback processes, ...) and we would like to have radiative transport as well
\tikz[remember picture] \node[coordinate] (n1) {};
\end{itemize}
\begin{tikzpicture}[remember picture,overlay] %% use here too
\path[draw=magenta,thick,->]<3-> ([yshift=2mm]n1.north) to [out=0, in=0,distance=1in] (t1.east);
\end{tikzpicture}
\end{block}
}
\end{document}
With tikzmark
:
\documentclass{beamer} %
\usetheme{CambridgeUS}
\usepackage[latin1]{inputenc}
\usefonttheme{professionalfonts}
\usepackage{times}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}
\author{Author}
\title{Presentation title}
\newcommand{\tikzmark}[1]{\tikz[remember picture] \node[coordinate] (#1) {#1};}
\begin{document}
\frame{
\frametitle{MATERIAL IN THE UNIVERSE}
\framesubtitle{Simulations need to account for the full cosmic matter-energy content}
\begin{block}{Main ingredients of the Universe:}
\begin{itemize}
\item Dark Energy \hspace{16.3 mm} $\Rightarrow $ expansion, $a(t)$
\item Dark Matter \hspace{16.3 mm} $\Rightarrow $ collisionless fluid, interacting \\ \hspace{68 mm} via gravity
\item Baryonic Matter (`gas') $\Rightarrow $ \tikzmark{t1},\\ \hspace{68 mm} self-gravity
\end{itemize}
\begin{itemize}[<+-| alert@+>]
\item that is actually not enough,\tikzmark{n1} we need to include sub-resolution physics (cooling, star formation, feedback processes, ...) and we would like to have radiative transport as well
\end{itemize}
\begin{tikzpicture}[remember picture,overlay]
%\path[draw=magenta,thick,->]<3-> ([yshift=3mm]n1) to ++(0,3mm) to [out=0, in=0,distance=2.5in] (t1);
\path[draw=magenta,thick,->]<3-> ([yshift=3mm]n1) -- (t1);
\end{tikzpicture}
\end{block}
}
\end{document}
Best Answer
If I have understood your question correctly, you are writing something like,
$Person\rightarrow Man$
and the text involved, are coming out in italics.To begin with, it is incorrect to say that the text is coming out in italics. They are coming out in math mode.
Please try to see the difference between the following two,
From the first one, you get the output of your text in italics, from the second one, text is actually coming out as math characters. See the different spacing among characters?
Anyway, one way of doing what you are asking for (arrows in grammar rules) will be to write
Person $\rightarrow$ Man
. But you loose the excellent spacing around operators provided by LaTeX. So, the best way will be to put the whole inside math mode, and use\text
command from amsmath package to specify the text.From this solution, you get your text as text, as well as, you enjoy the spacing around operators provided by TeX math mode.