I am trying to write my dissertation using the document class that my university demands that we use for these things and working in overleaf (as suggested by the university too). Strangely, the apostrophes (') inside math mode are not being printed in the output pdf. See the picture below.


This is of course a big problem. If I open another simple tex file in Overleaf and and use math mode then everything works as it should.

Below are the packages that I am using. The first ones, without description, are from my papers that I want to include in the dissertation. The rest are part of the university provided template. Does anyone know what the problem might be?

\usepackage{amsmath,amssymb,amsthm, bm}

\usepackage[spanish, english]{babel}

% PurdueThesis.cls loads the rotating package which loads the graphicx
% package.  From
%     Packages in the `graphics' bundle
% at
%     http://ftp.math.purdue.edu/mirrors/ctan.org/macros/latex/required/graphics/grfguide.pdf
% on page 12
%     \graphicspath{<dir-list>}
%         This optional declaration may be used to specify a list of
%         directories in which tosearch for graphics files.  The
%         format is the same as for the LATEX 2e primitive\input@path.
%         A list of directories, each in a{}group (even if there is
%         only one in the list).  For
%         example:\graphicspath{{eps/}{tiff/}}would cause the system
%         to look in the subdirectories eps and tiff of the
%         currentdirectory.  (All modern TeX systems use / as the
%         directory separator, even on Windows.)   The default setting of
%         this path is \input@path that is: graphics files will be found
%         whereever TeX files are found.
% Look in the "graphics" subfolder for graphics files.
% This is done to reduce the number of files in the main thesis folder
% so the ones in there are easier to find.

% Look in the "packages" subfolder for packages.
% This is done to reduce the number of files in the main thesis folder
% so the ones in there are easier to find.

% Configure bibliography.
% Automatically configure the bibliography.  Based on the
% institution, campus, and program listed in the \documentclass
% command \bibprocessor is set to "biblatex" or "bibtex".
% For biblatex, a
%    \usepackage[...]{biblatex}
% is done.  Put your bibliography entries in all-biblatex.bib.
% For bibtex, a
%     \bibliographystyle{...}
% command is done.  Put your bibliography entries in all-bibtex.bib.
% All combinations of institution, campus, and program use biblatex.
% Exceptions that use bibtex:
%     o  "Purdue University", "West Lafayette", "Earth, Atmospheric,
%        and Planetary Sciences" uses the ametsoc2014 bibliography style.
%     o  "Purdue University", "West Lafayette", "Veterinary Clinical
%        Sciences" uses the ama bibliography style.
% To override the default choices picked by \ConfigureBibliography, change,
% for example,
%     \ConfigureBibliography
% to
%     % \ConfigureBibliography
%     \newcommand{\bibprocessor}{biblatex}
%     \usepackage[backend=biber, citestyle=apa, dashed=false, sortcites=true, style=apa]{biblatex}
%     \addbibresource{all-biblatex.bib}

% This is only relevant if you are using biblatex.
% This is an example of how to ignore urldate fields in your .bib file.
% See the first complete example on page 201 of
%     https://mirrors.rit.edu/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf
% If you don't want to ignore urldate fields,
% comment out (put "%" before) the next ten lines.
        \step[fieldset=urldate, null]

% For chemical figures, \chemfig.

% For \VerbatimInput.
  % https://andreas.scherbaum.la/blog/archives/670-Read-number-lines-in-a-file-in-LaTeX.html
  % Indent verbatim by 23.5pt so line numbers are within margin.

% pages 11--12.  
% This gets rid of
%     [5] (./thesis.toc
%     ! Undefined control sequence.
%     \vbox_set:Nn ...box:D {\color_group_begin: #2\par 
%                                                       \color_group_end: }
%     l.32 ...}Basic Circuit Components}{31}{section.67}
%                                                       %
%     ? 
% and
%     [6]
%     ! Undefined control sequence.
%     \vbox_set:Nn ...box:D {\color_group_begin: #2\par 
%                                                       \color_group_end: }
%     l.61 ...rline {P.1}Frenchspacing}{67}{section.445}
%                                                       %
%     ?
% errors.
% See
%     https://github.com/latex3/latex2e/issues/73

% For indexing.  Making an index is optional.
% Make these commands available:
%     \index{string}    put "string" in index information
%     \makeindex        save information to make the index
%     \printindex       print the index
% See
%     https://ctan.org/pkg/makeidx?lang=en
% for more information.
  % By default \index ignores its argument.
  % This activates indexing.
  % The "chapter name" for the index.

% For TeX, LaTeX, METAFONT, METAPOST, etc. related logos.
% This includes all the logos in the dtk-logos package, see
%     http://mirrors.ctan.org/macros/latex/contrib/hologo/hologo.pdf
% plus some extra definitions I made in pa-logos.sty.

% For typographical conventions stuff including
%     \Emph{...}
%     \First{...}
%     \Keys{...}
%     \Literal{...}
%     \Menu{...}
%     \Place{...}
%     \Shell{...}

% For FloatBarrier.
% Put \FloatBarrier to process all unproccesed floats (tables and figures).

% The mathtools package
% (see http://mirror.utexas.edu/ctan/macros/latex/required/amsmath/amsmath.pdf)
% loads the amsmath package which defines the
%     align
%     align*
%     alignat
%     alignat*
%     equation
%     equation*
%     flalign
%     flalign*
%     gather
%     gather*
%     multitaper
%     multitaper*
%     split
% environments and extends amsmath by defining many other commands.
% See
%     https://ctan.org/pkg/amsmath
% for information about amsmath and
%     http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/mathtools/mathtools.pdf
% for information about mathtools.

% Follow ISO 80000-2:2019
%     o   put e, i, and pi in upright font automatically
%     o   use, for example, "\di x" to get "\,mathrm{d}\/x"
% This loads
%     o   amsmath.sty (which is already loaded above)
%     o   mathtools.sty
%     o   upgreek.sty
% Load the package.
  % Tell mismath that e, i, j, and pi in upright font automatically.
  % To typeset math italic e, i, j, and pi use
  %     \mathit e
  %     \mathit i
  %     \mathit j
  %     \itpi

% Define \includemedia.

% Define ``multicols'' environment environment used in demo-multicols.tex.

% For \ditto command.

% For \DigitDash---a dash the width of a digit in the current font.

% For \MyRepeat---????.

% For \textcent.

% Needed for chapter "Graphics", section "TikZ and PGF".

% Needed for the Feynman diagram in ap-physics.tex.
% Tikz-feynman requires lualatex instead of pdflatex be run.

% For \verbatiminput.
  • 3
    I've submitted an edit to format the very large chunk of code so that it's scrollable.
    – dbmag9
    May 30 '21 at 14:19
  • 2
    One reason that this site requires a minimal working example (MWE) for problems is that systematically removing parts of your code to see which part is causing the problem is an important trouble-shooting step; you should post code which compiles in LaTeX but still exhibits your problem (and is minimal, i.e. anything else removed would mean it no longer compiles or no longer shows the problem).
    – dbmag9
    May 30 '21 at 14:21
  • You're loading packages named pa-??? which seem to be local packages. It's impossible to debug something without seeing the code that produces the issue.
    – egreg
    May 30 '21 at 14:45
  • latex will not silently drop characters look in the log for for missing character warnings, and edit your example removing all the irrelevant packages but adding the relevant math font set up that you have not shown. The code should be in a form that anyone can run it and see the problem. May 30 '21 at 16:04
  • @DavidCarlisle I reduced the problem, removing all the packages, to the PurdueThesis document class, which is this long file. Should I try to reduce this cls file too? I can't find any missing character warnings.
    – Anguepa
    May 31 '21 at 8:45

As a fallback, you can use $ f^{\prime}(x) $ instead of $ f'(x) $. However, the notation with the accent should work, and below is about how to fix that.

Like discussed in the comments, it's hard to really help without knowing what is going on at your end. But my best guess is that the apostrophe (') is modified somewhere to have quotes work 'nicer', but without taking its use in math mode into account.

Try adding the following code right above your \begin{document}:

\def'{\ifmmode ^\bgroup\expandafter\prim@s\else\expandafter\oldapo\fi}

Is the prime still missing in math? If so, try moving this code to after the \begin{document}.

If it doesn't work

Remove the code provided above and add the following to your document:

\PackageWarning{DEBUG}{Meaning of accent1: (\meaning')}
(Meaning of accent1: (\meaning'))

\PackageWarning{DEBUG}{Meaning of accent2: (\meaning')}
(Meaning of accent2: (\meaning'))

\PackageWarning{DEBUG}{Meaning of accent3: (\meaning')}
(Meaning of accent3: (\meaning'))

This should output some warnings in your code. Share them in a comment on my answer, or update your original question to include them. It's information which can help us see what's going on at your end.

If you can't find it as warning, the lines should also be printed as normal text in your document. Copy it, or make a screenshot of that.

And make sure to say if it worked for you! :)

  • 1
    This is fantastic thank you very much. The first piece of code works. It is huge and much needed help in finishing my thesis before the deadline!
    – Anguepa
    Jun 4 '21 at 12:49

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.