This may have been asked before, but I couldn't find it with my limited vocabulary of linguistic terms.

When writing a paragraph of running text that's broken up by a (code) example block or figure, how do I end the previous incomplete sentence and how do I continue the sentence?

I used to do it like this, with a colon and ellipsis:

For instance, the rewrite rule:

 |[ i + j ]| -> |[ k ]| where <add>(i, j) => k 

...expresses constant folding for addition.

Here's how the Rust programming language book does it, capitalizing the continued sentence:

You can also set another attribute based on a cfg variable with cfg_attr:

#[cfg_attr(a, b)]

Will be the same as #[b] if a is set by cfg attribute, and nothing otherwise.

Here's how the Stratego language manual does it:

For instance, the rewrite rule

 |[ i + j ]| -> |[ k ]| where <add>(i, j) => k 

expresses constant folding for addition.

What is the correct way to do this?

  • 2
    I think this is largely a matter of opinion. That said, personally I use the third style, and feel the ellipsis and especially the capitalized letter are wrong. The colon I can tolerate. Commented May 20, 2015 at 12:53
  • It may surprise you to know that this has nothing to do with linguistics.
    – Robusto
    Commented May 20, 2015 at 12:59
  • This kind of question should be asked on Writing. Commented May 22, 2015 at 0:49

1 Answer 1


Mermin's guide on equations has a lot to say about this in the math domain. See: http://www.pamitc.org/documents/mermin.pdf

The suggested practice is to include equations or snippets as if they were words in the sentence that flow inline in the text, obeying standard English rules for punctuation. For example, one might speak about the Pythagorean identity,

a^2 + b^2 = c^2 ,

where a, b, and c are the sides of the triangle. This doesn't work as well for code snippets where the comma may be lexically significant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.