[Tex/LaTex] How to write following equations in LaTeX format
equationsmath-mode
I need to add the two equations below in LaTeX, at the center of the page, without referencing.
I am a beginner and I need some expert help. (I need to add also the description text of m, n, xmn, and ymn)
Best Answer
Something like this?
\documentclass{article}
\usepackage{mathtools,array}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
\begin{gather*}
\mathit{MSE}=\frac{1}{mn} \sum_{i=1}^m \sum_{j=1}^n (x_{ij}-y_{ij})^2 \\[2ex]
\begin{array}{@{} l >{$}l<{$} @{}}
m & number of rows in cover image\\
n & number of columns in cover image\\
x_{ij} & pixel value from cover image\\
y_{ij} & pixel value from stego image
\end{array} \\[2ex]
\mathit{PSNR}(x,y)=\frac{10\log_{10}[\max(\max(x),\max(y))]^2}{\abs{x-y}^2}
\end{gather*}
\end{document}
Addendum to address the OP's follow-up questions. (a) To surround equations or groups of equations) with rectangular boxes, use the \boxed instruction. (b) To give an equation a caption, place it in a figure environment and use a \caption instruction.
\documentclass{article}
\usepackage{mathtools,array}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\counterwithin{figure}{section} % optional
\usepackage[font={sf},skip=0.5\baselineskip]{caption} % optional
\begin{document}
\setcounter{section}{2} % just for this example
\setcounter{figure}{8}
\begin{figure}[ht!]
\[
\boxed{%
\begin{gathered}
\mathit{MSE}=\frac{1}{mn} \sum_{i=1}^m \sum_{j=1}^n (x_{ij}-y_{ij})^2 \\[1ex]
\begin{array}{@{} l >{$}l<{$} @{}}
m & number of rows in cover image\\
n & number of columns in cover image\\
x_{ij} & pixel value from cover image\\
y_{ij} & pixel value from stego image\\
\end{array}
\end{gathered}
}% end of scope of \boxed
\]
\caption{MSE Algorithm}
\end{figure}
\[
\boxed{%
\mathit{PSNR}(x,y)=\frac{10\log_{10}[\max(\max(x),\max(y))]^2}{\abs{x-y}^2}
}
\]
\end{document}
Instead of centering you may consider to align all equations at the equal sign and center the whole multiline environment. For this, use the align or align* environment, see the amsmath user's guide (or type texdoc amsldoc at the command prompt).
In any case, use amsmath. That package provides many kinds of multiline diplayed formula environments.
Best Answer
Something like this?
Addendum to address the OP's follow-up questions. (a) To surround equations or groups of equations) with rectangular boxes, use the
\boxed
instruction. (b) To give an equation a caption, place it in afigure
environment and use a\caption
instruction.