3

I'm wondering about what's the "correct" symbol to use when typesetting standard string concatenation (I've seen How do I typeset the concatenation of strings properly? btw, but it deals with a non-standard variant of concatenation, which I'm not interested in).

Should one use || directly or \parallel? Or maybe something else completely? I'm not able to make up my mind about the first two. || seems to be what I'm after usually, but sometimes it feels like it leaves too little space between the concatenated words. Conversely, \parallel also seems to work sometimes, but often leaves too much space between words.

So, which one to chose if I were to do this "correctly"?

5
  • 2
    Definitely not \parallel that qualifies as a relation symbol; doing \newcommand{\conc}{\mathbin{\|}} will give a double bar spaced like a binary operation.
    – egreg
    May 21, 2014 at 12:43
  • I know \cdot, as in abc = a \cdot b \cdot c.
    – Raphael
    May 21, 2014 at 12:55
  • There are more symbols for parallel lines (see my page martin-thoma.de/write-math/view/… ) May 21, 2014 at 13:01
  • @moose That makes it even more confusing! I already had trouble choosing among two options :-D Which one is the best of those?
    – hakoja
    May 21, 2014 at 13:08
  • @hakoja: As there seems to be no symbol for concatenation of symbols, I would define a macro just like dbmag9 says. So \newcommand{\concatenate}{\textdoublepipe} is what I would go for. After that you can use \concatenate everywhere. Should you then think that \textdoublepipe doesn't look nice enough, you can simply replace it by \shortparallel once in the definition. May 21, 2014 at 13:15

1 Answer 1

5

Define \conc at the start to be whatever symbol you want to use. Then you can redefine it if you need to, because you're being semantically appropriate. That has the additional advantage that you can globally set the symbol type (ie if you want it to behave as an operator or relation) or manually change the kerning.

2
  • I'll accept your answer, but it would be nice if you could also suggest one concrete choice of symbol to use. @egreg and @moose has already suggested several different options in their comments (\mathbin{\|}, \textdoublepipe and \shortparallel). Hence which one of these "should" one prefer?
    – hakoja
    May 22, 2014 at 8:12
  • I deliberately didn't recommend one as I'm not familiar with the subject area or that specific notation. If there's no clear convention in the literature already I would just pick on aesthetic grounds, since no one if those seems more informatively suggestive than the others.
    – dbmag9
    May 22, 2014 at 9:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .