2

How to write a equation like the following which contain many regions? GHASH

Anne
  • 23

2 Answers2

4

Use cases environment

\documentclass{article}
\usepackage{amsmath}

\begin{document}\begin{equation}
f(n) = \begin{cases} n/2 &\mbox{if } n \equiv 0 \\
(3n +1)/2 & \mbox{if } n \equiv 1 \\
(3n +1)/2 & \mbox{if } n \equiv 1 
\end{cases}
\end{equation}
\end{document}

enter image description here

David Carlisle
  • 757,742
Red
  • 10,181
  • 1
    Better \text{…} than \mbox{…}. And if you load mathtools insteado of amsmath, you can use cases* environment, which sets the second column to text mode. – Manuel Dec 11 '13 at 16:34
3

Here is MWE that can help you to begin:

enter image description here

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
\[  X_i=
    \begin{cases}
    0                           & \text{ for } i=0\\
    (X_{i-1}\oplus A_i)\cdot H  & \text{ for } i=1,\dotsc,m-1
    \end{cases}
\]
\end{document}

Also read the following:

  1. https://tex.stackexchange.com/a/122497/10898
azetina
  • 28,884