4

I've used \textsuperscript to represent ordinals like 1st, 2nd, and so forth.

Other post here about this:

What's the quickest way to write "2nd" "3rd" etc in LaTeX?

The results are supposed to be single spaced and there is un-even line spacing because the superscript "st" on "1" causes a little extra space between lines.

What I'd like instead is the "st" to be smaller, and elevated, but have its top at same height as number 1. Here's ASCII art

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

I found a post in here about regulating size & placement of \textsupserscript:

How can I make something like a superscript that doesn't go as high?

I do not understand the advice there, but I have implemented it nonetheless. This goes in the preamble

\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}}}}

That code is unfamiliar to me. I hope one of you will tell me if it is wise. Will unexpected problems arise in a larger document?

The \Textsuperscript function is not perfect. With large text, even the "fixed" superscript goes above the text line. If I use \Large{...} text then the unevenness is noticable, but not if text is \normal{...}. This difference is pointed out in the original post.

The Update: After several of you said that superscripts cannot affect line spacing, I started tearing apart the document and I built the MRE that shows YOU WERE CORRECT. I was fooled because of the effect of LaTeX groups on line spacing. The difference is especially clear to me in the footer, where I was sure the superscript caused a problem. But paragraphs in text show they were not to blame.

I simply did not understand the impact of using group, like this:

{\Large{} blah blah.}

compared to

\Large{blah blah.}

maybe even

\Large{} blah blah.

I had spotted the problem first in a fancy footer, where line spacing seems to be especially sensitive to this. In the test cases, we had a much larger document written by a team and each person had his/her own style. By coincidence, when the grouping differed, the superscripts were also present. When a few people are writing on a document at same time, I suppose it is expected to happen.

This code:

\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}

And here is the output

enter image description here

  • 1
    How tightly spaced is your single-spaced document? With ordinary baselineskip settings (e.g., 10/12), 1\textsuperscript{st}, 2\textsuperscript{nd} should not cause any widening of the basic line spacing. – Mico Mar 14 '17 at 17:37
  • Could you please tell how you use \Large? – egreg Mar 14 '17 at 18:08
  • 1
    You should post an example that demonstrates this clearly - including everything in the preamble related to fonts and spacing. That way we can replicate the issue and test potential fixes. – Chris H Mar 14 '17 at 18:09
  • Despite the fact that the superscript did not cause the line spacing problem in this case, I think the superscript method proposed by @Fran below looks very nice. I don't know what the professional typography would dictate, but it is exactly matching the request I had to re-set the ordinal superscript. – pauljohn32 Mar 15 '17 at 22:40
  • As I suspected, you're using wrongly \Large. In the first instance the paragraph ends outside the scope of it, so the normal baselineskip is used; in the second instance, the effect of it will continue forever. – egreg Mar 15 '17 at 23:47
2

(too long for an comment, hence posted as an answer)

Unless your document has unusually tight line-spacing settings, writing things like 1\textsuperscript{st} or 3\textsuperscript{rd} should definitely not cause TeX to increase the line spacing to accommodate the superscript-level material.

To wit:

enter image description here

Loading the fmtcount package with the option raise, and writing things like \ordinalnum{1} and \ordinalnum{3}, should produce the exact same output as does writing 1\textsuperscript{st} and 3\textsuperscript{rd}:

enter image description here

In short, please advise what the exact line spacing settings are in your document.

Just for completeness, here's the code that gave rise to the preceding screenshots:

\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}
  • Mico's answer gave me idea of what to look for. The problem is not the superscript, it is actually a different error that alters line spacing in a way that I mistakenly blamed on superscripts. I'll put the mre into question. – pauljohn32 Mar 15 '17 at 22:22
  • I think it would be helpful if you posted the new/revised part of your query as a new question, especially as its material appears to be quite unrelated to the original part of the query. In the new question, please state clearly which typesetting issues you're looking to fix. – Mico Mar 16 '17 at 5:58
1

Use the fmtcount package (you can define shortcuts such as \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} 

enter image description here

  • I can detect absolutely no difference in the output of 1\textsuperscript{st} and \ordinalnum{1}, 2\textsuperscript{nd} and \ordinalnum{2}, etc. – Mico Mar 14 '17 at 17:36
  • @Mico: I didn't even try to compare: the O.P. complained of an uneven line spacing, due to the usage of \textsuperscript. I just showed this package does increase linespacing locally. – Bernard Mar 14 '17 at 17:42
  • I tried to reproduce the OP's issue, i.e., to generate uneven linespacing due to the presence of 1\textsuperscript{1st} and 3\textsuperscript{rd}, but I can't reproduce the issue at all. I've asked the OP to clarify what linespacing settings he/she has got. – Mico Mar 14 '17 at 17:47
  • I just posted an answer to demonstrate that (with ordinary single-spaced settings) writing things like 1\textsuperscript{1st} and 3\textsuperscript{rd} should not cause any uneven line-spacing issues to begin with. – Mico Mar 14 '17 at 18:06
  • I tested too. I think Mico's correct on this. – pauljohn32 Mar 15 '17 at 22:34
1

If the ubiquitous graphicx package is not a problem for you, you can simply scale down the superscript text and raise it conveniently ex times:

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

The result should work for any font size (even beyond \tiny or \Huge with a scalable font as libertine):

mwe

\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}
  • That's neat! I like the look of it, just for style. It prevents the superscript from going up into the space. I think it is very helpful. You get +1 for this. But Mico diagnosed the problem: my user error! – pauljohn32 Mar 15 '17 at 22:37
  • @pauljohn32 You're welcome. Yes, I saw that Mico's pointed that \textscript is not the true problem, but anyway I thought interesting develop your idea showed in the ASCII art. – Fran Mar 16 '17 at 1:45
0

In general: When you move something off the baseline, and it causes lines to spread, you can usually fix it with the \smash command. Like this:

\smash{some text}

In some cases, \smash must go on the outside of styled text. In other cases, it must go inside, with the styling command around it. Experiment.

If the text is at the beginning of a paragraph, it may help to write \strut in front.

The \smash command gives the included text the magical power to overlap other text. So, when a piece of text is moved off the baseline, it will not push away the text above or below it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.