GeneralHow do I modify the equation serial number and its caption

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

How do I modify the equation serial number and its caption

Post by akira32 »

How do I modify the equation serial number and its caption?
Now the equation show the serial number as (7.1).
But I want the string of the caption of the equation as (Eq7.1).
How do I modify the command of equation?

Code: Select all

Eq\ref{eq:equation_cost_time1}
[/color]

Code: Select all

\begin{equation}
T_{total} = T_{eye} + T_{sm} + T_{SRT} + 4 \times T_{each tile}+ 4 \times 4 \times T_{each tile}
\label{eq:equation_cost_time1}
\end{equation}
[/color]

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How do I modify the equation serial number and its caption

Post by gmedina »

You can redefine the counter:

Code: Select all

\documentclass{book}
\usepackage{amsmath}

\renewcommand{\theequation}{Equation \arabic{chapter}.\arabic{equation}}

\begin{document}

\chapter{Dummy Chapter}
\begin{equation}\label{eq:fermat}
  x^n+y^n=z^n
\end{equation}
As we see in \ref{eq:fermat}

\end{document}
I assumed that you were using book as your document class; of course, you can adapt my example according to your needs.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

How do I modify the equation serial number and its caption

Post by akira32 »

gmedina,thank you! It works. But how about the matrix?
My matrix does not have the serial number.
How do I add the serial number to the matrix and use the \ref with "{Matrix \arabic{chapter}.\arabic{matrix}}"?

Code: Select all

\[
mView = \left[
\begin{array}{cccc}
xaxis.x      &     yaxis.x   &        zaxis.x     &     0 \\
 xaxis.y     &      yaxis.y   &        zaxis.y    &      0\\
 xaxis.z           yaxis.z     &      zaxis.z     &     0\\
-dot(xaxis, eye) & -dot(yaxis, eye) & -dot(zaxis, eye) & l
\end{array}
\right]
\]
[/color]
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How do I modify the equation serial number and its caption

Post by gmedina »

You can use some of the features provided by the float and caption packages. Refer to the documentations for further information.

Code: Select all

\documentclass{book}
\usepackage{amsmath}
\usepackage{caption}
\usepackage{float}

\newfloat{matrix}{H}{mat}[chapter]

\DeclareCaptionLabelFormat{myStyle}{(#2)}
\captionsetup[matrix]{labelformat=myStyle}

\renewcommand{\theequation}{Equation \arabic{chapter}.\arabic{equation}}
\renewcommand{\thematrix}{Matrix \arabic{chapter}.\arabic{matrix}}

\begin{document}

\chapter{Dummy Chapter}
\begin{equation}\label{eq:fermat}
  x^n+y^n=z^n
\end{equation}
As we see in \ref{eq:fermat}

\begin{matrix}
  \[
  mView = \left[
  \begin{array}{cccc}
    xaxis.x          & yaxis.x          & zaxis.x          & 0 \\
    xaxis.y          & yaxis.y          & zaxis.y          & 0\\
    xaxis.z          & yaxis.z          & zaxis.z          & 0\\
    -dot(xaxis, eye) & -dot(yaxis, eye) & -dot(zaxis, eye) & l
  \end{array}
  \right]
  \]
  \caption[]{}
  \label{mat:matrix}
\end{matrix}
As shown in \ref{mat:matrix}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply