2

I am writing a book by using BYUtextbook document class (http://optics.byu.edu/BYUTextbook.zip).

In the example, I want to get rid of the word "Example 1.1" enter image description here

Which part of cls file I need to modify?

Thank you for your help.

The following is a part of cls file which suspect to deal with this

\newcounter{example}[chapter]
\renewcommand{\theexample}{\thechapter.\arabic{example}}
\usepackage{ifpdf}
\ifpdf
    \renewcommand{\theHexample}{\thechapter.\arabic{example}} %This is needed to keep unique links for hyperref
\fi


\renewcommand{\thefigure}{\thechapter.\arabic{figure}}
\usepackage{ifpdf}
\ifpdf
    \renewcommand{\theHfigure}{\thechapter.\arabic{figure}} %This is needed to keep unique links for hyperref
\fi

%\newenvironment{example}[1]
%    {\cbcolor{BarColor}\par \vspace{8pt} \cbstart
%    \begin{enumerate}\item[]
%     \refstepcounter{example}\noindent\textbf{Example \theexample}
%     \par\vspace{500pt}\small\noindent\noindent#1
%     \par\vspace{20pt}\noindent\textbf{Solution:}
%    }
%    {\end{enumerate} \cbend\par \vspace{10pt}}

\newenvironment{example}
    {\cbcolor{BarColor}\par \vspace{10pt} \begin{changebar}
    \begin{enumerate}\item[]
     \refstepcounter{example}\noindent\textbf{Example
     \theexample} } {\end{enumerate} \end{changebar}\par \vspace{8pt}}

\newcommand{\exProblem}{\par\vspace{2pt}\small\noindent\noindent}
\newcommand{\exSolution}{\par\vspace{10pt}\noindent\textbf{Solution:} }
1
  • I can't really recommend to modify the class file. Just write your own package mydefs.sty (=collection of add-ons and modifications that you need) and load it after \documentclass{...} by \usepackage{mydefs}. Alternatively, copy the class file to a new file myclass.cls and load it instead of the BYU class. But then you should know the effects and side-effects of what you are doing in this class file.
    – gernot
    Dec 10, 2016 at 11:18

2 Answers 2

1

I suggest to define a new environment unnumberedexample that does what you want.

\newenvironment{unnumberedexample}
    {\cbcolor{BarColor}%
     \par
     \vspace{10pt}%
     \begin{changebar}%
     \begin{enumerate}%
     \item[]%
    }%
    {\end{enumerate}%
     \end{changebar}%
     \par
     \vspace{8pt}%
    }

I wouldn't redefine the original environment since it is useful if you want to refer to an example from some other place in your document; then you will need a numbered example.

enter image description here

\documentclass{BYUTextbook}
\newenvironment{unnumberedexample}
    {\cbcolor{BarColor}%
     \par
     \vspace{10pt}%
     \begin{changebar}%
     \begin{enumerate}%
     \item[]%
    }%
    {\end{enumerate}%
     \end{changebar}%
     \par
     \vspace{8pt}%
    }
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{unnumberedexample}
\blindtext
\end{unnumberedexample}
\blindtext
\end{document}
1

Your class contains the following code for the example environment:

\newenvironment{example}                                
    {\cbcolor{BarColor}\par \vspace{10pt}
    \begin{changebar}\begin{enumerate}\item[]                            
    \refstepcounter{example}\noindent\textbf{Example \theexample} }% here is your Example text.
    {\end{enumerate}\end{changebar}\par \vspace{8pt}}

 # Redefined example environment in Preamble

You can optionally doctor up this code until it meets your expectations.

\renewenvironment{example}
  {\cbcolor{BarColor}\par \vspace{10pt}
  \begin{changeable}\begin{enumerate}\item[]
  \refstepcounter{example}}}% removed: \noindent Example + counter register literal text
{\end{enumerate}\end{changeable}\par\vspace{8pt}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .