0

I am writing a lab report for a class, and I have run into a problem. I need to have multiline equations, and then have a caption below them saying something along the lines of "Equation 1: ". I tried simply adding a \caption to it, but since equation environment isn't a float, it didn't work. I followed what another page said, and surrounded it in a figure environment, but then it labeled it as a figure, and it needs to be an "Equation". Here is an example.


\documentclass[CMPE]{KGCOEReport}

\usepackage{float}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{xcolor,colortbl}
\definecolor{Gray}{gray}{.9}

\begin{document}

\begin{table}[H]
    \caption{Truth table for mathematical operations $N^2$ and $5N$}\vspace{.1cm}
    \label{tab:truth}
    \centering

    \begin{tabular}{|c|c|c||c|c|c|c|}
        \hline
        $C$ & $N1$ & $N0$ & $W$ & $X$ & $Y$ & $Z$ \\
        \hline
        \rowcolor{Gray}0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        \hline
        0 & 0 & 1 & 0 & 0 & 0 & 1 \\
        \hline
        \rowcolor{Gray}0 & 1 & 0 & 0 & 1 & 0 & 0 \\
        \hline
        0 & 1 & 1 & 1 & 0 & 0 & 1 \\
        \hline
        \rowcolor{Gray}1 & 0 & 0 & 0 & 0 & 0 & 0 \\
        \hline
        1 & 0 & 1 & 0 & 1 & 0 & 1 \\
        \hline
        \rowcolor{Gray}1 & 1 & 0 & 1 & 0 & 1 & 0 \\
        \hline
        1 & 1 & 1 & 1 & 1 & 1 & 1 \\
        \hline
    \end{tabular}
\end{table}

\begin{figure}[H]\begin{equation}
    \centering
    \label{eq:w}
    \begin{split}
        W  & = (C\cdot N_1\cdot N_0) + (C \cdot N_1 \cdot \overline{N_0}) + (\overline{C}\cdot N_1 \cdot N_0) \\
        \textrm{(Distributivity)} & = C(N_1\cdot N_0 + N_1\cdot\overline{N_0}) + (\overline{C}\cdot N_1\cdot N_0) \\
        \textrm{(Combining)} & = C(N_1) + \overline{C}\cdot N_1\cdot N_0 \\
        \textrm{(Distributivity)} & = N_1(C + \overline{C}\cdot N_0) \\
        \textrm{(Redundant Literal Rule)} & = N_1(C+N_0) \\
        \textrm{(Distributivity)} & = C\cdot N_1 + N_1\cdot N_0 \\
    \end{split}
\end{equation}
\caption{Simplification of $W$, with steps shown}
\end{figure}

\end{document}

The output of that equation block is Equation block, with figure label

This looks good, except for the Figure 1 part.

Edit: Here is the document class I am using.


\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{KGCOEReport}[2016/05/25 Example LaTeX class]

%%%%%%% Base class
\LoadClass[12pt]{article}

%%%%%%% Required packages
\RequirePackage{multicol} %Make columns
\RequirePackage[margin=1in]{geometry} %Change margins
\RequirePackage[most]{tcolorbox}  % For the "RIT" box on EEEE cover

\setlength{\parindent}{0pt} % Don't indent paragraphs

%%%%%%% Internal functions and environments
% Used to make sure the TA listing is even
\newenvironment{_TAalignment}{%
\def\\{\newline\leavevmode\phantom{TA:}}
}

%%%%%%% External functions and environments

%%%%%%% Write a CE report
\DeclareOption{CMPE}{
    \newcommand{\KGCOEDocType}{CMPE}

    \renewcommand{\maketitle}{%
    \vspace*{2.5cm}

        \begin{center}
            \large
            \textbf{\classCode \ Laboratory Exercise \exerciseNumber}

            \bigskip

            \textbf{\exerciseDescription}
            \normalsize
        \end{center}

        \vspace*{5cm}

        \begin{multicols}{2}
            \phantom{LaTeX doesn't like empty columns} % Phantom will take up that much space, but not actually appear
            \columnbreak{} % Starts the second column
            \begin{flushleft} % Make sure LaTeX does not try to justify these lines
                \name\\
                Performed: \dateDone\\
                Submitted: \dateSubmitted\\
                \vspace*{\baselineskip} % Adds one line of spacing on this line, like the template
                Lab Section: \LabSectionNum\\
                Instructor: \LabInstructor\\
                TA:\begin{_TAalignment}\TAs  % There can't be a space between the \TAs and the enviroment declaration
                \end{_TAalignment}
                \vspace*{\baselineskip}
                Lecture Section: \LectureSectionNum\\
                Professor: \LectureInstructor\\
            \end{flushleft}
        \end{multicols}


        \vspace{1cm}

        By submitting this report, you attest that you neither have given nor have received any assistance (including writing, collecting data, plotting figures, tables or graphs, or using previous student reports as a reference), and you further acknowledge that giving or receiving such assistance will result in a failing grade for this course.

        \vfill

        {\centering{}
        Your Signature: \hrulefill}

        \newpage
    }
}
%%%%%%% Write a EE report
\DeclareOption{EEEE}{
    \newcommand{\KGCOEDocType}{EEEE}

    \renewcommand{\maketitle}{%

        \begin{flushright}\begin{tcolorbox}[colback=black,coltext=white,halign=center,boxrule=0pt,
            sharp corners, width=0.5\textwidth, fontupper={\Large \bfseries}]
            Rochester Institute of \\ Technology
        \end{tcolorbox}\end{flushright}

        \huge
        \textbf{\classCode \ - \className \ Technical Memo}\\
        \normalsize

        \noindent
        \begin{tabular}{ll}
        \textbf{From:} &\name\\

        % Optional parameter of partner
        \ifdefined\partnerName
            \textbf{Partner:} &\partnerName\\
            \\
        \fi

        \textbf{To:} &\TAs \ | Section \LabSectionNum\\
        \textbf{Date:} &Performed: \dateDone; Due: \dateSubmitted\\
        \textbf{Subject:} &Lab \exerciseNumber: \exerciseDescription
        \end{tabular}

        \noindent
        \rule{\textwidth}{.1pt}
    }
}
% Pass any other options to
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions

%%%%%%% Check to see if we were given a correct department code
\@ifundefined{KGCOEDocType}{\ClassError{KGCOEReport}{Unrecognized Department Code}{Available department codes are CMPE, EEEE}}{}
Seth G
  • 41
  • 5
  • 1
    Welcome! It is neither usual nor recommended to treat equations as figures. It is much more common to add further explanations in the text around the equations. –  Feb 09 '18 at 05:17
  • I added the document class I am using – Seth G Feb 09 '18 at 05:37
  • Off-topic: Don't write \usepackage{xcolor,colortbl}; instead, write \usepackage[table]{xcolor}. That way, both packages are set up to cooperate optimally. – Mico Feb 09 '18 at 05:59

0 Answers0