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:
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.


\textsuperscriptnor\texttrademarkis 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\titleor\authoruse the offending code? – rallg Mar 26 '23 at 22:18\documentclass[a4paper,svgnames,11pt]{article}– Alix Blaine Mar 27 '23 at 12:44\textorpdfstringyou 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\texttrademarkis 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\texorpdfstringis 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\texorpdfstringis supposed to be used, which should be sufficient to fix the mistake here. – Marijn Apr 02 '23 at 11:53