0

I have a strange problem, whenever I make a reference in the body of the text e.g. ....in Equation \ref{MyEquationOne} all subsequent main body text after the reference is changed to the same font style and formatting configuration as the equation or figure reference -- And I can't see why:

Here is an example

    \documentclass{report}

    \usepackage[reqno]{amsmath}
    \usepackage{Baskervaldx}
    \usepackage[baskervaldx,upint]{newtxmath}
    \usepackage[margin=25mm]{geometry}
    \usepackage[margin=9mm]{caption}
    \usepackage[font={small}]{caption}
    \usepackage[hang,bottom]{footmisc}
    \usepackage{natbib}
    \usepackage{graphicx}
    \usepackage{subfiles}
    \usepackage{amsfonts}
    \usepackage{graphicx}\graphicspath{{figures/}}
    \usepackage{array}
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage{upgreek}
    \usepackage{subcaption}
    \usepackage{listings}
    \usepackage{color}
    \usepackage{float}
    \usepackage{dcolumn}
    \usepackage{fancyhdr}
    \usepackage{xfrac}
    \usepackage{pdfpages}
    \usepackage{epigraph}
    \usepackage{etoolbox}
    \usepackage{booktabs}
    \usepackage{titlesec}
    \usepackage{bm}
    \usepackage{tocloft}
    \usepackage{blindtext}
    \usepackage{circuitikz}
    \usepackage{tikz}\usetikzlibrary{arrows,decorations,shapes}\usetikzlibrary{decorations.markings,decorations.pathmorphing}

    \renewcommand{\contentsname}{\centering\scshape\LARGE\normalfont{TABLE OF CONTENTS}}
    \renewcommand{\listfigurename}{\centering\scshape\LARGE\normalfont{LIST OF FIGURES}}
    \renewcommand{\listtablename}{\centering\scshape\LARGE\normalfont{LIST OF TABLES}}
    \renewcommand{\bibname}{\centering\scshape\LARGE\normalfont{BIBLIOGRAPHY}}
    \renewcommand{\thechapter}{\scshape\Roman{chapter}}
        \titleformat{\chapter}{\centering\scshape\LARGE\normalfont\color{black}}{\thechapter.}{1pt}{}
        \makeatletter
        \def\@makechapterhead#1{%
            \vspace*{-5em}% Space above number
            {
                \parindent \z@  \scshape
                \interlinepenalty\@M
                \Large\centering \scshape{\thechapter}%
                \par\vspace{1mm}% Space between number and title
                \MakeUppercase{#1}%
                \par\vspace{2.5em}% Space between title and text
            }
        }
        \makeatother

    \makeatletter
    \patchcmd{\epigraph}{\@epitext{#1}}{\itshape\@epitext{#1}}{}{}
    \makeatother
    \setlength\epigraphwidth{16cm}
    \setlength\epigraphrule{0pt}

    \numberwithin{equation}{section}

    \begin{document}

    \chapter{THE PEAK LINESHAPE}

      \section*{Introduction}
Here I go making some point about something or other, then BAM! I need an equation which looks like,
\begin{equation}
      E = m c^{2} \text{.}
      \label{EQN:MyFirstEquation}
    \end{equation}
After blathering on some more I want to talk about Equation \ref{EQN:MyFirstEquation}, but Oh no! Now the main body text has been changed -- help!
\end{document}
3

Your "minimal working example" is not that minimal. Here is a version that removes lots of extraneous stuff and enables one to diagnose the problem:

\documentclass{report}
\usepackage{amsmath}
\renewcommand{\thechapter}{\scshape\Roman{chapter}}
\numberwithin{equation}{section}

\begin{document}
\chapter{THE PEAK LINESHAPE}
\section*{Introduction}
Here I go making some point about something or other, then BAM! I need an equation which looks like,
\begin{equation}
  E = m c^{2} \text{.}
  \label{EQN:MyFirstEquation}
\end{equation}
After blathering on some more I want to talk about Equation \ref{EQN:MyFirstEquation}, but Oh no! Now the main body text has been changed -- help!
\end{document}

The problem is with the redefinition of \thechapter. You have used \scshape, which then affects all the text that follows. A better method would be to use:

\renewcommand{\thechapter}{\textsc{\Roman{chapter}}}
  • 3
    Or wrap the \scshape in a second set of braces. – Davislor Feb 8 at 10:33
  • 1
    A further thought crossed my mind. Why are you using \scshape with \Roman anyway? \Roman will produce capital roman letters, where \scshape affects the lowercase letters (at least as far as my eyes can discern). – Martyn Quick Feb 8 at 12:09
  • Thanks both for the suggestions. I figure it's better to give too much than too little. I've seen strange little conflicts with packages before. Thanks for the solutions. @Davislor Your suggestion also worked! – Q.P. Feb 8 at 12:40

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.