序数词带有小的、凸起的上标,但不超过字符?

序数词带有小的、凸起的上标,但不超过字符?

我曾经用它\textsuperscript来表示序数,例如第一、第二等等。

关于此问题的其他帖子:

在 LaTeX 中,最快写出“2nd”、“3rd”等的方法是什么?

结果应该是单倍行距,并且行距不均匀,因为“1”上的上标“st”导致行之间有一点额外的空格。

我希望“st”更小、更高,但其顶部与数字 1 的高度相同。这是 ASCII 艺术

 ###    ####   #####
  ##    #        #
  ##    ####     #
  ##       #     #
  ##    ####     #
  ##
  ##
  ##
#####

我在这里找到了一篇关于调节尺寸和位置的帖子\textsupserscript

我怎样才能制作出不像上标那么高的东西呢?

我不明白那里的建议,但我仍然实施了它。这是序言中的内容

\makeatletter
\newlength\mylen
\DeclareRobustCommand*\Textsuperscript[1]{%
\@Textsuperscript{\selectfont#1}}
\def\@Textsuperscript#1{%
\settoheight\mylen{\fontsize\f@size\z@ A}%
{\m@th\ensuremath{\raise.3\mylen\hbox{\fontsize\sf@size\z@#1}}}}

我对这段代码不太熟悉。希望有人能告诉我这是否明智。在更大的文档中是否会出现意想不到的问题?

\Textsuperscript功能并不完美。对于大文本,即使是“固定”上标也会超出文本行。如果我使用\Large{...}文本,则不均匀是显而易见的,但如果是文本,则不会\normal{...}。原始帖子中指出了这一差异。

更新: 在你们中的一些人说上标不能影响行距之后,我开始拆解文档,并创建了 MRE,以证明你们是对的。我被 LaTeX 组对行距的影响所欺骗。页脚中的差异对我来说尤其明显,我确信上标造成了问题。但文本中的段落表明它们不是罪魁祸首。

我只是不明白使用组的影响,如下所示:

{\Large{} blah blah.}

相比

\Large{blah blah.}

甚至会

\Large{} blah blah.

我首先在一个花哨的页脚中发现了这个问题,行距似乎对此特别敏感。在测试案例中,我们有一个由团队编写的更大的文档,每个人都有自己的风格。巧合的是,当分组不同时,上标也会出现。当几个人同时在文档上书写时,我想这种情况是可以预料到的。

此代码:

\documentclass[letterpaper,landscape,american,11pt]{article}
\usepackage[scaled=0.8]{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{hhline}
\makeatletter

\DeclareUnicodeCharacter{00A0}{}
\providecommand{\tabularnewline}{\\}
\makeatother

\usepackage{calc}
\usepackage{setspace}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{multicol}
\usepackage{multirow}
\usepackage[normalem]{ulem}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{ifthen}
\usepackage[landscape,letterpaper,verbose,
        tmargin=1.5cm, bmargin=3.5cm, lmargin=2.25cm, rmargin=2.25cm,
        headheight=100pt, footskip=20pt,
        marginparwidth=0pt, includehead]{geometry}
\setlength{\parskip}{\smallskipamount}
\setlength{\parindent}{0pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
\usepackage{lipsum}
\definecolor{gray1}{HTML}{ebebeb}
\definecolor{blue1}{rgb}{0.2617188, 0.6328125, 0.7890625}
\definecolor{green1}{rgb}{0.6562500, 0.8632812, 0.7070312} 

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist

\begin{document}
\righthyphenmin=3
\lefthyphenmin=4
\raggedright
%https://tex.stackexchange.com/questions/12703/how-to-create-fixed-width-table-columns-with-text-raggedright-centered-raggedlef
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\smallskip{}
\smallskip{}
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{
\begin{tabular}{@{}>{\raggedright}p{5.5cm}>{\centering}m{13cm}p{5.5cm}}
\footnotesize{\textbf{REPORT DATE}: 03-13-2017} &
\textbf{\LARGE{}Data Summary} &
\multirow{3}{*}{\large{pretend there is a logo here}}\tabularnewline
\footnotesize{\textbf{SUBJECT}: Bidding Accuracy}&\multirow{1}{*}{\textbf{\Large{}Report 2016-17}}\tabularnewline
{\footnotesize{}\textbf{Bridge Team}: 3}&\tabularnewline
 &  & \tabularnewline
\end{tabular}
\begin{tabular}{@{}>{\raggedright}p{17.25cm}>{\raggedleft}p{6cm}}
\Large\textbf{NAME:} PJ &
\Large\textbf{DISTRICT ID:}34534523234\tabularnewline
\Large\textbf{DISTRICT:} Smith&
\Large\textbf{STATE}: Neverland\tabularnewline
\Large\textbf{Center:} Academy of Bridge&\tabularnewline
\end{tabular}}

\fancyfoot[L]{Suppose there is a beautiful message here in line 1 of footer. \\
  \smallskip{}
  \ifthenelse{\value{page}=1}{{\small{}This report is intended to smarten you
 up and we exect you will really like reading it this year.  It has a glorious 
summary of all kinds of great ideas that we have polished up during the last year. 
This is the 1\textsuperscript{st} superscript in this footer.}\\
    \small{}Some legal statement here. There will be a claim of
    copyright, possibly a statement about availabilty under a GNU
    documentation license or Creative commons.  Probably a boring one,
    so we make it extra small so nobody will complain to us about
    it. This the first time we have used this format.  }{} }
\fancyfoot[R]{Page \thepage \hspace{1pt} of \pageref{LastPage}}

\renewcommand{\headrulewidth}{0pt} 
\renewcommand{\footrulewidth}{0pt}

{\Large{}The team's performance in the year's program is summarized
  below. They were never extremely strong in any of the events. In
  fact, we don't think they were 1\textsuperscript{st}, ever. We have
  had many excellent participants this year and it is very difficult
  to say that one is better than the other. However, your group is,
  definitely, not better than the 2\textsuperscript{nd},
  3\textsuperscript{rd}, or 4\textsuperscript{th} groups.  }

\Large{The team's performance in the year's program is summarized
  below. They were never extremely strong in any of the events. In
  fact, we don't think they were 1\textsuperscript{st}, ever. We have
  had many excellent participants this year and it is very difficult
  to say that one is better than the other. However, your group is,
  definitely, not better than the 2\textsuperscript{nd},
  3\textsuperscript{rd}, or 4\textsuperscript{th} groups.}
\end{document}

下面是输出

在此处输入图片描述

答案1

(评论太长,因此作为答案发布)

除非你的文件有异常紧张行距设置,写入诸如1\textsuperscript{st}或之类的内容3\textsuperscript{rd}绝对不会导致 TeX 增加行距以适应上标级别的材料。

以机智:

在此处输入图片描述

fmtcount使用选项加载包raise,并写入诸如\ordinalnum{1}和之类的内容,应该产生与写入和\ordinalnum{3}完全相同的输出:1\textsuperscript{st}3\textsuperscript{rd}

在此处输入图片描述

简而言之,请告知您文档中的具体行距设置。

为了完整起见,下面是产生上述截图的代码:

\documentclass[12pt]{article} % or: 10pt, 11pt
\usepackage[english]{babel}
\usepackage[raise]{fmtcount}
\usepackage{xcolor}

\newlength\mylen
\settowidth\mylen{blg blg blg blg blg blg blg blg blg}
\let\ts\textsuperscript

\begin{document}
\noindent
\begin{minipage}{\mylen}\color{red}
blg blg blg blg blg blg blg blg blg 
blg blg blg blg blg blg blg blg blg 
blg blg blg blg blg blg blg blg blg 
blg blg blg blg blg blg blg blg blg 
blg blg blg blg blg blg blg blg blg
\end{minipage}%
\begin{minipage}{\mylen}\color{blue}
blg blg blg blg blg blg blg blg blg 
blg blg blg blg blg blg blg blg blg 
blg blg 1\ts{st} 2\ts{nd} 3\ts{rd} 4\ts{th} 5\ts{th}\, blg blg
blg blg blg blg blg blg blg blg blg 
blg blg blg blg blg blg blg blg blg
\end{minipage}

\medskip\noindent
1\ts{st} \ordinalnum{1} 2\ts{nd} \ordinalnum{2}  3\ts{rd} \ordinalnum{3} 4\ts{th} \ordinalnum{4}  5\ts{th} \ordinalnum{5} 
\end{document}

答案2

使用fmtcount包(您可以定义快捷方式,如\first,,second&c):

\documentclass[english]{article}
\usepackage{babel}
\usepackage[raise]{fmtcount}

 \begin{document}

 Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.

 \ordinalnum{1} \ordinalnum{2} \ordinalnum{3} %
  Some more text. Some more text. Some more text. Some more text. Some more text.

  \end{document} 

在此处输入图片描述

答案3

如果无处不在的graphicx包对您来说不是问题,您可以简单地缩小上标文本并方便地将其提升 ex多次:

\newcommand\TSC[1]{\raisebox{.8ex}{\scalebox{.4}{#1}}}

结果应该适用于任何字体大小(甚至超出\tiny\Huge具有可缩放字体libertine):

姆韦

\documentclass{article}
\usepackage{graphicx}
\usepackage{libertine}

\newcommand\TSC[1]{\raisebox{.8ex}{\kern-.15em\scalebox{.4}{#1}}}

\begin{document}

\fontsize{4}{6}\selectfont 1\TSC{B}
\fontsize{5}{8}\selectfont 1\TSC{B}
\scriptsize  1\TSC{B}
\footnotesize 1\TSC{B}
\small 1\TSC{B}
\normalsize 1\TSC{B}
\large 1\TSC{B}
\Large 1\TSC{B}
\huge 1\TSC{B}
\Huge 1\TSC{B}
\fontsize{30}{40}\selectfont 1\TSC{B}
\fontsize{40}{50}\selectfont 1\TSC{B}
\fontsize{50}{60}\selectfont 1\TSC{B}

\end{document}

答案4

一般来说:当你将某个东西移出基线,并导致线条扩展时,通常可以使用命令来修复它\smash。像这样:

\smash{some text}

在某些情况下,\smash必须放在样式文本的外面。在其他情况下,它必须放在里面,周围有样式命令。试验一下。

如果文本位于段落的开头,则将其写在前面可能会有所帮助\strut

\smash命令赋予了所包含文本神奇的覆盖其他文本的能力。因此,当一段文本移出基线时,它不会推开其上方或下方的文本。

相关内容