我知道之前有相当多关于如何排版反斜杠的问题被问到;但我正在寻找 \ 的特定位置,如下所示:
我试过了\diagdown
,但无法将其放在G
\ 下面,如屏幕截图所示。
答案1
\documentclass{article}
\usepackage{amsmath}
\newcommand\mySlash[2]{\ensuremath{%
\!\sideset{_#1}{\!\!^#2}{\mathop\backslash}}}
\begin{document}
\Huge$x\cdot\mySlash{G}{X}$ \mySlash{G}{X}
\end{document}
答案2
我只需使用堆栈创建相对于反斜杠的分子和分母,然后将两部分合并在一起。
\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\usepackage{calc}
\newlength\tbsw
\setlength{\tbsw}{\widthof{\textbackslash}}
\newcommand\bsfrac[2]{%
\renewcommand\stacktype{L}%
\renewcommand\stackalignment{r}%
\mathop{%
\stackunder[4pt]{\textbackslash}{$\scriptstyle #1$~}%
\kern-\tbsw%
\renewcommand\stackalignment{l}%
\stackon[3pt]{\textbackslash}{~$\scriptstyle #2$}%
}%
}
\begin{document}
The quotient (or orbit) space $\bsfrac{G}{X}$ is the set\ldots
\end{document}
以下是另一种选择,其反斜杠更加倾斜:
\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\usepackage{graphicx}
\def\tbs{\rotatebox{30}{\textbackslash}}
\newlength\tbsw
\setlength{\tbsw}{\widthof{\tbs}}
\newcommand\bsfrac[2]{%
\renewcommand\stacktype{L}%
\renewcommand\stackalignment{r}%
\mathop{%
\stackunder[3pt]{\tbs}{$\scriptstyle #1$\ \,}%
\kern-\tbsw%
\renewcommand\stackalignment{l}%
\stackon[4pt]{\tbs}{\ \,$\scriptstyle #2$}%
}%
}
\begin{document}
The quotient (or orbit) space $\bsfrac{G}{X}$ is the set\ldots
\end{document}
答案3
以下是基于的答案角度分数。TikZ 的使用有点繁重,但我不知道其他方法可以做到这一点......
\documentclass{article}
\usepackage{tikz}
\usepackage{calc}
\newcommand*{\TextScale}{0.75}
\newcommand*{\SlashAngle}{-45}
\newcommand*{\SlashScale}{1.5}
\newlength{\NeumeratorXShift}
\newlength{\DenomiatorXShift}
\newlength{\NeumeratorYShift}
\newlength{\DenomiatorYShift}
\tikzset{Slash/.style={scale=\SlashScale, rotate=\SlashAngle}}
\tikzset{Neumerator/.style={scale=\TextScale, xshift=-\NeumeratorXShift, yshift=-\NeumeratorYShift, inner sep=0, outer sep=0}}
\tikzset{Denominator/.style={scale=\TextScale, xshift=\DenomiatorXShift, yshift=\DenomiatorYShift, inner sep=0, outer sep=0}}
\newcommand{\Sfrac}[2]{%
\pgfmathsetlength{\NeumeratorXShift}{0.1em+0.5*\widthof{$#1$}}%
\pgfmathsetlength{\DenomiatorXShift}{0.1em+0.5*\widthof{$#2$}}%
\pgfmathsetlength{\NeumeratorYShift}{0.2ex+0.5*\heightof{$#1$}}%
\pgfmathsetlength{\DenomiatorYShift}{0.2ex+0.5*\heightof{$#2$}}%
\tikz [x=1.4ex,y=1.4ex,line width=.09ex, baseline, yshift=0.6ex]
\draw [Slash] (-0.45,0.0) -- (0.45,0)
node [Neumerator ] at (0,0) {$#1$}
node [Denominator] at (0,0) {$#2$};
}%
\begin{document}
The quotient (or orbit) space $\Sfrac{G}{X}$ is the set of blablabla ...
\end{document}
答案4
模仿周围间距的解决方案\frac
,但带有倾斜的分数线。
\documentclass{article}
\usepackage{graphicx}
\makeatletter
\newcommand*{\revfrac}[2]{%
\ensuremath{%
\mathchoice
{\revfrac@{\displaystyle}{\textstyle}{#1}{#2}}%
{\revfrac@{\textstyle}{\scriptstyle}{#1}{#2}}%
{\revfrac@{\scriptstyle}{\scriptscriptstyle}{#1}{#2}}%
{\revfrac@{\scriptscriptstyle}{\scriptscriptstyle}{#1}{#2}}%
}%
}
\newcommand*{\revfrac@factor}{.5}
\newcommand*{\revfrac@}[4]{%
% dimen 0: height of math axis
\setbox0=\hbox{$#1\vcenter{}$}%
\dimen0=\ht0 %
%
% box 0: numerator
\sbox0{$#2#3\m@th$}%
\ifdim\dp0=\z@
\else
\setbox0=\hbox{\raise\dp0\box0}%
\fi
%
% box 2: denominator
\sbox2{$#2#4\m@th$}%
\ifdim\dp2=\z@
\else
\setbox2=\hbox{\raise\dp2\box2}%
\fi
%
% dimen 2: max. width of unrotated fraction = length of fraction line
\ifdim\wd0>\wd2 %
\dimen2=\wd0 %
\else
\dimen2=\wd2 %
\fi
% box 4: rotated fraction line with middle point at base line
% dimen 4: side bearings of \frac
% dimen 6: half of the thickness of rule with separation space
% For getting the line separation space, an object with an depth
% is needed to minimize the space
\setbox4=\hbox{\kern1ex}%
\dimen6=\wd4 %
\sbox4{%
$%
#1%
\frac{\kern\dimen2\vrule width\z@ depth\dimen6}{\kern\dimen2}%
\m@th
$%
}%
\dimen4=.5\dimexpr\wd4-\dimen2\relax
\dimen6=\dimexpr\ht4-\dimen0-\dimen6\relax
\setbox4=\hbox to \dimen2{\hss\lower\dimen0\copy4\hss}%
\ht4=.2pt %
\dp4=.2pt %
\sbox4{\rotatebox[x=.5\wd4,y=\z@]{-30}{\copy4}}%
%
% output left side bearing
\kern\dimen4 %
% output denominator
\dimen8=\dimexpr
-.5\wd2 %
+.4330127\dimexpr\revfrac@factor\ht2\relax % 0.4330127 = 0.5 * sin(60)
+.125\wd2 % .125 = .5 * sin(30) * sin(30)
+.5\dimen6 % 0.5 = sin(30)
-.5\wd4 %
\relax
\ifdim-\dimen8>\wd2 %
\kern\dimexpr-\dimen8-\wd2\relax
\fi
\raise\dimexpr
\dimen0 %
-\ht2 %
-.216506351\wd2 % 0.216506351 = 1/4 sin(60)
-.8660254\dimen6 % 0.8660254 = sin(60)
+.25\dimexpr\revfrac@factor\ht2\relax % 0.25 = sin(30) * sin(30)
\relax\copy2 %
% output fraction line
\kern\dimen8 %
\raise\dimen0\copy4 %
% numerator
\dimen8=\dimexpr
-.5\wd4 %
+.4330127\dimexpr\revfrac@factor\ht0\relax % 0.4330127 = 0.5 * sin(60)
+.125\wd0 % .125 = .5 * sin(30) * sin(30)
+.5\dimen6 % 0.5 = sin(30)
-.5\wd0 %
\relax
\kern\dimen8 %
\raise\dimexpr
\dimen0 %
+.216506351\wd0 % 0.216506351 = 1/4 sin(60)
+.8660254\dimen6 % 0.8660254 = sin(60)
-.25\dimexpr\revfrac@factor\ht0\relax % 0.25 = sin(30) * sin(30)
\relax\copy0 %
\ifdim-\dimen8>\wd0 %
\kern\dimexpr-\dimen8-\wd0\relax
\fi
% output right side bearing
\kern\dimen4
}
\makeatother
\begin{document}
\centering
The quotient space $\revfrac{X}{G}$ is the set of \dots
\[
X = \bigsqcup_{\bar x\in\revfrac{X}{G}} \bar x
\]
\[
\revfrac{X}{G}
> \textstyle \revfrac{X}{G}
> \scriptstyle \revfrac{X}{G}
> \scriptscriptstyle \revfrac{X}{G}
\]
\newcommand*{\fboxed}[1]{%
\begingroup
\setlength{\fboxsep}{0pt}%
\setlength{\fboxrule}{.2pt}%
\fbox{$#1$}%
\endgroup
}
\[
\fboxed{\revfrac{a}{b+c+d}}\;
\fboxed{\revfrac{\fboxed{a+b+c}}{d}}\;
\fboxed{\revfrac{\fboxed{\frac{a}{b}}}{\fboxed{\frac{c}{d}}}}
\;\fboxed{\revfrac{\fboxed{a}}{\fboxed{b+c+d}}}
\]
\end{document}