4

I work with Cryptocode package in $\LaTeX$ and want to generate discription of games with oracles. My goal is to generate something like: Source:https://eprint.iacr.org/2023/275
(Source: https://eprint.iacr.org/2023/275)

If my understanding is correct, this is generate via a pcvstack/pchstack-combination (p. 32 in documentation: https://ftp.rrzn.uni-hannover.de/pub/mirror/tex-archive/macros/latex/contrib/cryptocode/cryptocode.pdf). There is to my knowledge no intended parameter to separate horizontal stacks with a vertical line as on the picture. Is there any elegant solution to this problem? My current best attempt is to introduce dummy procedure inbetween filled with vertical rule:

\documentclass{report} \usepackage{cryptocode} \begin{document} \begin{pchstack}[space=1em,center, boxed] \procedure{$\mathsf{Left}$}{ \text{Hello,} } \procedure{}{ \rule{0.4pt}{1.5cm} } \procedure{$\mathsf{Right}$}{ \text{Tex StackExchange} } \end{pchstack} \end{document} 

But that is not ideal because of the awkward spacing:

Any well-known workaround?

0

2 Answers 2

2

If you don't want to draw the line manually (which requires determining the length) then you can put the procedures in two tabulars, and draw the relevant line for the longest tabular (here they are equally long so I picked the left line for the second tabular). This does mess up the space calculation for boxed but you can add a bit of extra space with \qquad or any other horizontal space command.

MWE:

\documentclass{report} \usepackage{cryptocode} \usepackage{mdframed} \begin{document} \begin{pchstack}[space=1em,center,boxed] \begin{tabular}{l} \procedure{$\mathsf{Left}$}{ \text{Hello,} }\end{tabular} \begin{tabular}{|l} \procedure{$\mathsf{Right}$}{ \text{Tex StackExchange} }\qquad\end{tabular} \end{pchstack} \end{document} 

Result:

two procedures separated by a vertical line

0

Here is a way to do it with your code:

  • set space=0em
  • specify width for left procedure
  • use \hspace{ }

However ...

\documentclass{report} \usepackage{cryptocode} \begin{document} \begin{pchstack}[space=0em,center,boxed]% changed \procedure[width=3cm]{$\mathsf{Left}$}{ % changed \text{Hello,} } \hspace{1cm} % new \procedure{}{ \rule{0.4pt}{1.5cm} } \procedure[linenumbering]{$\mathsf{Right}$}{ \text{Tex StackExchange} } \end{pchstack} \end{document} 

result

... you still need to readjust the length of the vertical rule. A more convenient way would be to:

  • use vertical lines with the tabbing functionality (if available)
  • use the built-in Tikz features

However, you'd probably need to wrap the right procdeure inside a bbrbox, which is a Tikz thingy, so it can be named, e.g. (box). IF you can switch off the frame, you could do sth. like \draw (box.north west) -- (box.south west); . However, this may need some realignments, or using the same approach for the left procedure.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.