# Problems with making formula look great [closed]

I have problems to make the below formula look great. Do you have any ideas on how I can make it look better?

This is this LaTeX code I have for it:

PTK = $PRF(PMK, \text{"Pairwise key expansion"} || Min(AA, SPA) || \\ Max{AA, SPA}|| Min(ANonce, SNonce) || Max(ANonce,SNonce))$


I appreciate all help!

## closed as primarily opinion-based by JouleV, Sebastiano, Stefan Pinnow, Phelype Oleinik, RaajaMar 15 at 20:57

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to TeX.SE. In order to help produce an expression that is not only visually appealing but also factually correct and meaningful, it would help to know what || stands for. Please advise. – Mico Mar 15 at 10:03
• @Mico Seems more like a norm-like operator to me. – Raaja Mar 15 at 10:06
• @Mico In cryptography || means string concatenation. – nomadictype Mar 15 at 15:16
• What does "great" mean? – David Richerby Mar 15 at 18:49
• Perhaps you could be more specific in your request. What is it that you do not like about your current output? We are happy to help with LaTeXing specific requests, but without explaining what you want, "great" and "better" are matters of opinion. – Sandy G Mar 15 at 20:27

I don't know if it looks great, but do you want something like this?

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\begin{split} \text{PTK} = & \text{PRF}\left( \text{PMK}, \text{"Pairwise key expansion"} || \min(\text{AA}, \text{SPA}) || \right. \\ & \left. \qquad \max(\text{AA}, \text{SPA})|| \min(\text{ANonce}, \text{SNonce}) || \max(\text{ANonce},\text{SNonce})\right) \end{split}$

\end{document}

• Thanks a lot for the great answer! – Johan Mar 15 at 10:45

Taking Ignasi's approach a step further...

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{split} \text{PTK} = \text{PRF}\bigl( &\text{PMK}, \text{Pairwise key expansion''} \\& || \min(\text{AA}, \text{SPA}) \\ & || \max(\text{AA}, \text{SPA})\\&|| \min(\text{ANonce}, \text{SNonce}) \\&|| \max(\text{ANonce},\text{SNonce})\bigr) \end{split}$
\end{document}


MFGA

• Thanks a lot for the great answer, I'll go for this one! – Johan Mar 15 at 10:44
• @Johan Thanks. While you can click the up-arrow to "upvote" any question or answer on this site that you find helpful, you can select only one answer for each of your questions to click the check on, as a means to "accept" the most suitable answer. – Steven B. Segletes Mar 15 at 10:49

IMHO your formula is in an algorithm and || stands for "or". So you should have a look at algorithm packages. Anyway this is a non-algorithm but algorithmic answer:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{array}{r@{}l@{}l} \text{PTK}=PRF&(PMK, & \text{Pairwise key expansion''}\\ && || \min(AA,SPA)\\ && || \max(AA,SPA)\\ && || \min(ANonce,SNonce)\\ && || \max(ANonce,SNonce)\\ &)& \end{array}$
\end{document}


### Edit 1: Improved version

I prefer this way.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{array}{rl} \text{PTK}=PRF(&\\ & PMK,\\ & (\\ & \quad\text{Pairwise key expansion''}\\ & \quad||\min(AA,SPA)\\ & \quad||\max(AA,SPA)\\ & \quad||\min(ANonce,SNonce)\\ & \quad||\max(ANonce,SNonce)\\ & )\\ )& \end{array}$
\end{document}


• Alright thanks a lot! I'm not so good at LaTeX so I'll go for this one, since it looks much better than before! Not sure how much algorithm package would have improved it, but this looks good enough. – Johan Mar 15 at 10:43
• @Johan I already improved my answer. – JouleV Mar 15 at 10:46

I have two proposals. Most important is to properly define macros for specific object types in your document, in order to ensure uniformity.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\OOR}{\mathrel{\|}}
\newcommand{\tvar}[1]{\mathrm{#1}}
\newcommand{\tdesc}[1]{\textup{#1''}}

\begin{document}

\begin{aligned} \tvar{PTK}=\tvar{PRF}\bigl( &\tvar{PMK},\tdesc{Pairwise key expansion} \\ & \OOR \min(\tvar{AA},\tvar{SPA})\\ & \OOR \max(\tvar{AA},\tvar{SPA})\\ & \OOR \min(\tvar{ANonce},\tvar{SNonce})\\ & \OOR \max(\tvar{ANonce},\tvar{SNonce}) \bigr) \end{aligned}

\begin{multline*}
\tvar{PTK}=\tvar{PRF}\bigl(
\tvar{PMK},\tdesc{Pairwise key expansion}
\OOR \min(\tvar{AA},\tvar{SPA}) \OOR \\
\max(\tvar{AA},\tvar{SPA})
\OOR \min(\tvar{ANonce},\tvar{SNonce})
\OOR \max(\tvar{ANonce},\tvar{SNonce}) \bigr)
\end{multline*}

\end{document}