0

The following code produces the result in the picture below.

How can I avoid text justification at the line that starts with "Create Challenge"? I have tried to apply what is suggested here but it does not work in my case.

\begin{figure}
\centering
\fbox{
    \parbox{\textwidth}{
\centerline{\textbf{Protocol $\Pi_{GR}$}}
\bigbreak
Parties $\mathcal{P}$ = \{$\mathcal{P}_{1}$,..., $\mathcal{P}_{n}$\} interact with each other and with $\mathcal{F}_{SmartContract}$, $\mathcal{F}_{RandomCommittee}$, $\mathcal{F}_{Voting}$ as follows:
\bigbreak
\textbf{Create Challenge}: On input $(\textsc{Create-Challenge}, sender, value)$ send $(\textsc{Create-Challenge}, sender, value)$ to $\mathcal{F}_{SmartContract}$.
\newline
\textbf{Accept Challenge}:
\newline
    }
}
\caption{Protocol $\Pi_{GR}$.} \label{fig:sm}
\end{figure}

Result of the code

If I apply \parbox{\textwidth}{\raggedright it is closer to what I want, but it does not split the mathematical expression between two lines.

Result of applying suggestion

Lorenzo
  • 23
  • 4
  • 1
    Try with \parbox{\textwidth}{\raggedright – MadyYuvi May 14 '20 at 14:47
  • Thanks a lot. It is closer to what I want, but it does not split the mathematical expression between two lines (I edited the question with the result). I suppose this is another problem however. I had a similar problem with long citations in the past. – Lorenzo May 14 '20 at 14:56
  • 1
    @Lorenzo: So you want it split, possible between CREATE- and CHALLENGE? – Werner May 14 '20 at 15:46
  • Yes, I tried with \allowbreak without success. As far I understand, you need to add this command manually (or by using a macro) anyway. – Lorenzo May 14 '20 at 16:38
  • If you want the three $\mathcal{F}... expressions at the end of the second (input) line to all go to a new line, you can replace the input spacebar spaces between them by ~ to "tie" them together. This, together with \raggedright gives the result I think you want. – barbara beeton May 14 '20 at 20:26
  • Thanks @barbarabeeton, the problem I was talking about was related to $(\textsc{Create-Challenge}, sender, value)$, that I have now have replaced with (\textsc{Create-Challenge}, \textit{sender}, \textit{value}). It still does not split it between different lines, but since it is not anymore a mathematical expression using $, I suppose it should work. – Lorenzo May 14 '20 at 20:36

0 Answers0