5
\begin{eqnarray*} 
M \to {P_j}:{} & \left\{ {{{\left( {{n_1},{n_2},{{\left( {profile,{N_i},{N_i}\left( {\mathop  \leftrightarrow \limits^{K_S^i} } \right){P_j},\\  & \# \left( {{N_i}\left( {\mathop  \leftrightarrow \limits^{K_S^i} } \right){P_j}} \right)} \right)}_{K_P^j}}} \right)}_{K_P^j}},{{\left( {{n_0},{n_1},{{\left( {profile,{N_i},{N_i} \\ &\left( {\mathop  \leftrightarrow \limits^{K_S^i} }  \right){P_j},\# \left( {{N_i}\left( {\mathop  \leftrightarrow \limits^{K_S^i} } \right){P_j}} \right)} \right)}_{K_P^j}},{N_i}\left( {\mathop  \leftrightarrow \limits^{K_S^i} } \right){P_j}, \\ &\# \left( {{N_i}\left( {\mathop  \leftrightarrow \limits^{K_S^i} } \right){P_j}} \right),{N_i}\mathop  \leftrightarrow \limits^{n_S^i} M} \right)}_{K_{TS}^i = H\left( {K_p^j \oplus n_S^i} \right)}}} \right\}
\end{eqnarray*}

To split my long equation I used \begin{equation} \begin{split}, \begin{eqnarray*},and \begin{multline} etc. But all the time few brackets from equation just disapear as shown in figure below.

enter image description here

The correct equation is given below and I want to split it into 4 lines

enter image description here

2
  • 1
    (1) Never use eqnarray it is broken in many ways and only kept for backwards compatability. Use the macros from amsmath. (2) You cannot!!! break a \left ... \right construction across lines, you need to scale these manuallt. From the last image you post, you can clearly see that those fences are way too large, and the readability would benefit greatly by manual scaling. (3) Use a better construction to write above \leftrightarrow, for example load the mathtools package, it provides the missing \xleftrightarrow{...} that is missing from amsmath.
    – daleif
    Sep 13, 2018 at 7:33
  • 1
    (4) Also you cannot have \\ inside a { ... } group, so you'll need to clean that up as well.
    – daleif
    Sep 13, 2018 at 7:36

1 Answer 1

7

Some suggestions:

  • Don't overuse curly braces to group math elements. A proliferation of { and } symbols makes the code nearly unreadable -- while doing absolutely nothing for TeX's ability to actually typeset the mess.

  • As @daleif has already pointed out in a comment, do not use eqnarray: It is seriously deprecated. Use align instead. When using align, use & only to indicate alignment points. Don't forget to terminate lines with \\ (double backslash).

  • Don't use \left and \right for this multiline equation. It can't work. Instead, use \big, \Big, \bigg and \Bigg sizing directives.

  • Since there are quite a few parenthetic expressions, consider using square brackets instead of round parentheses for some of them.

  • Optional: Use \! ("negative thinspace") directives to "snug up" subscript terms.

  • Finally, again as @daleif has pointed out, load the mathtools package and use the \xleftrightarrow macro instead of \mathop\leftrightarrow\limits. (At any rate, \limits isn't needed.)

With these observations in mind, I think it's possible to display the equation across three, rather than four, rows.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for '\xleftrightarrow' macro
\begin{document}
\begin{align*}
M \to {P_j}\colon 
\Biggl\{ 
&\biggl[ n_1, n_2, \Bigl( 
  \text{profile}, N_i,
  N_i(\xleftrightarrow{K_S^i})P_j,
  \# \bigl( N_i(\xleftrightarrow{K_S^i}) P_j \bigr) 
  \Bigr)_{\!K_{\!P}^j} 
  \biggr]_{K_{\!P}^j}, \\
&\biggl[ n_0, n_1, \Bigl( 
  \text{profile}, N_i,
  N_i(\xleftrightarrow{K_S^i})P_j,
  \# \bigl( N_i(\xleftrightarrow{K_S^i})P_j \bigr)
  \Bigr)_{\!K_{\!P}^j}, \\
&\quad 
  N_i(\xleftrightarrow{K_S^i})P_j,
  \# \bigl( N_i(\xleftrightarrow{K_S^i})P_j \bigr),
  N_i\xleftrightarrow{n_S^i}M 
  \biggr]_{K_{\mathit{TS}}^i = H(K_{\!P}^j \oplus n_S^i)}
\Biggr\}
\end{align*}
\end{document} 
1
  • you're right of course, I'll delete my comment
    – daleif
    Sep 13, 2018 at 8:59

You must log in to answer this question.

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