0

This is what I have:, source: How to typeset subscript in usual text mode?.

\subsection{Code from Moral Kombat\texorpdfstring{\textsuperscript{\texttrademark}{Code from Moral Kombat\texttrademark}}}

Packages:

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\pagenumbering{Roman}
\setcounter{page}{1}

\usepackage{verbatim} \usepackage{minted} \usemintedstyle{xcode} \usepackage{xspace} \usepackage{scrhack} \usepackage{mathptmx} \usepackage{caption} \usepackage{blindtext} \usepackage{pifont,mdframed} \usepackage{enumitem} \usepackage{amssymb} \usepackage{amsmath} % For using \text in equations \usepackage{fixltx2e} \usepackage{hyperref} % Hyperlinks \usepackage[nameinlink,noabbrev,capitalise]{cleveref} % Better in-doc refs \usepackage[numbered]{bookmark} \usepackage{endnotes} \input{hyperendnotes.sty} \usepackage{etoolbox} \usepackage[title,toc,titletoc,page]{appendix} \usepackage{multirow} \usepackage[margin=2cm]{geometry} \usepackage{graphicx} \usepackage{float} % Better figure and table placements \usepackage{tabularx} \usepackage{csquotes} % For blockquote \usepackage[labelfont=it, labelsep=period]{caption} \usepackage{subcaption} \usepackage{color} \usepackage{xcolor,colortbl} \usepackage[final]{pdfpages} % used to include pdf to appendicies \usepackage{lipsum} \usepackage{microtype} % Slightly tweak font spacing for aesthetics \usepackage{lettrine} \usepackage{longtable} % \usepackage{ragged2e} \usepackage[export]{adjustbox} \usepackage{wrapfig} \usepackage{float} \usepackage{tabularray} \usepackage{microtype} % Slightly tweak font spacing for aesthetics \usepackage{xpatch}

Result:

enter image description here


EDIT: This works:

\subsection{Code from Moral Kombat\textsuperscript{\texttrademark}}

But, this results in the following WARNING(s).

Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `\mathsurround' on input line 9.

Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `\z@' on input line 9.

Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `superscript' on input line 9.

enter image description here

  • 2
    You misunderstood the linked answer. Maybe read my comment added there https://tex.stackexchange.com/questions/1013/how-to-typeset-subscript-in-usual-text-mode#comment1689447_1017 ? – user202729 Mar 26 '23 at 17:13
  • 2
    Neither \textsuperscript nor \texttrademark is acceptable in a pdf string. Perhaps a directly entered Unicode character would work (probably depends on which TeX engine you're using), or the brute force "(TM)". – barbara beeton Mar 26 '23 at 18:01
  • Does the \title or \author use the offending code? – rallg Mar 26 '23 at 22:18
  • @rallg, I am using: \documentclass[a4paper,svgnames,11pt]{article} – Alix Blaine Mar 27 '23 at 12:44
  • 3
    To expand on the comments above: inside \textorpdfstring you add the two versions, this is a command with two arguments. So either \subsection{\texorpdfstring{Code from Mortal Kombat\textsuperscript{\texttrademark}}{Code from Mortal Kombat (tm)}} or \subsection{Code from Mortal Kombat\texorpdfstring{\textsuperscript{\texttrademark}}{ (tm)}}. Note that I replaced "Moral" by "Mortal" in the example, as I believe you are talking about the video game and not about the documentary. – Marijn Mar 27 '23 at 13:24
  • Note also that \texttrademark is already superscript by itself, so you could also just use that (although it does look a bit large when it is not superscripted a second time). – Marijn Mar 27 '23 at 13:27
  • @Marijn, please post that as an answer. Thanks. – Alix Blaine Mar 27 '23 at 13:48
  • @Alix this is a duplicate, we have many questions where (correct use of) \texorpdfstring is the answer. I will see if I can find a suitable post later to use as a close target. – Marijn Mar 27 '23 at 14:25
  • 1
    @Marijn -- I can't find a decent duplicate, but this answer might help you put together a good answer here: https://tex.stackexchange.com/a/87751 – barbara beeton Mar 27 '23 at 14:43
  • The question I picked is not an exact duplicate (i.e., it doesn't contain the same mistake as in the question here of duplicating the text outside and inside of the command) but the answer does clearly explain how \texorpdfstring is supposed to be used, which should be sufficient to fix the mistake here. – Marijn Apr 02 '23 at 11:53

1 Answers1

0

This is the solution:

\subsection{Code from Mortal Kombat\texorpdfstring{\textsuperscript{\texttrademark}}{ (TM)}}