Correct formatting of step-by-step equation demonstrations in papers Working on some journal paper, it has pseudocode-ish/equation-ish demonstrations of the way some equations play out, along with actual reference values in the example proper; along the lines of:

i = i + 1

i = 2

Note: please assume the actual demonstrations are much more complex than this and actually require the reference values.

What is the correct formatting here? I have had it suggested to me the first line should be underlined, whereas I find putting the reference value in brackets more obvious - like so:

i = i + 1 (i = 2)

with the bracketed content right-aligned.
Suggestions?
I don't believe there is a correct way to do this, because you shouldn't put them together.

Writing i = i + 1 fully contains everything the reader should need to know about the statement.  If you really want to lay out both a theoretical pseudocode notation and walk through an iteration, I would do them separately.  One way might be something like:


for i in range(0, 10):
    i = i + 1
    print i

  
  In this step we print to the screen the numbers 1 through 10.  For example, in the first iteration i takes on the value 0 from the first line, then has 1 added to itself.  The third line then prints 1 to the screen.


This way your pseudocode is treated like a mathematical equation in a paper, indented or otherwise separate from regular text, then examples as you go are just included in the text.  Depending on your audience and the complexity of the statements, you might also trust your audience to be able to parse your pseudocode without the need for filling in sample values.  Feeling like you need to walk through an example with numbers might be a sign that your pseudocode needs improving.

In short, trying to mash them together as you're suggesting just seems confusing to me.  

The huge, important caveat to what I suggest: look through the literature specific to your field and see how this is done elsewhere.  If you can't find any examples of someone doing what you're asking about (which I assume to be the case since you're asking here rather than just emulating that), then don't do it.  Conversely, if you do find examples of it being done, copy that method.