排版老式阶乘

排版老式阶乘

我想排版一个老式的阶乘符号,想知道是否有一种优雅的方法可以做到这一点,并随字体大小缩放。理想情况下,我希望调用

\oldfact{\frac{1}{2}n(n+1)}

在数学模式下,输出的内容是一个只有两侧(左侧和底部)的框框所包围的内容。

输出看起来就像|__内容嵌在 L 形角落内一样。

在此处输入图片描述

我查看了不同的软件包,但找不到合适的东西。所以我暂时用基本下划线和规则以及适当的空格解决了这个问题,但我的解决方案的扩展性不是很好,而且代码确实很丑陋!

答案1

使用“newschool”的实现tikz

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\oldfactorial}[1]{%
\tikz[baseline]{\node[anchor=base,inner sep=0.3ex](mynode){\ensuremath{#1}};\draw(mynode.north west)--(mynode.south west)--(mynode.south east);\path[use as bounding box]($(mynode.south west)+(-0.3ex,-0.3ex)$)rectangle($(mynode.north east)+(0.3ex,0.3ex)$);}
}
\begin{document}
This is the old notation for the factorial $\oldfactorial{n}$. Some other text
in order to wrap the line and see what happens with interline spacing
below the symbol. It also works in subscripts
\[
X=\sum_{0\le i\le\oldfactorial{n}}A_i+\left(\oldfactorial{x^2}\right)
\]
Here's a big version:

{\Huge$\oldfactorial{n}$}
\end{document}

在此处输入图片描述

答案2

使用老派技巧的实现:

\documentclass{article}

\newcommand{\oldfactorial}[1]{\mathpalette\oldfactorialaux{#1}}
\newcommand{\oldfactorialaux}[2]{%
  {#1\mkern1mu\oalign{\vrule\,$#1#2\mathstrut$\,\cr\noalign{\hrule}}}}

\begin{document}
This is the old notation for the factorial $\oldfactorial{n}$. Some other text
in order to wrap the line and see what happens with interline spacing
below the symbol. It also works in subscripts
\[
X=\sum_{0\le i\le\oldfactorial{n}}A_i
\]
Here's a big version:

{\Huge$\oldfactorial{n}$}
\end{document}

在此处输入图片描述

答案3

这对我有用

\documentclass{article}
\usepackage{amsmath}
\newcommand{\oldfact}[1]{\underline{\!\left\lvert #1\right.}}
\begin{document}
\[
 \oldfact{\frac{1}{2} n(n+1)}
\]
\end{document}][1]

在此处输入图片描述

相关内容