TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using package algorithmcx and algpseudocode to describe an algorithm in a paper. Each function in the algorithm receive an array/list of numerical values, e.g. {x1, x2, ..., xn}.




    \Function{FUN\_NAME}{$\{x_i^j \,|\, i \in A, j \in B \}$}


I don't know if the list of values/variables is represented in the right way.

I've got a look through the Web to see if there was such an accepted convention for representing an array, but I didn't find any example.

How can I represent them?

share|improve this question
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – egreg Nov 26 '12 at 16:55
@egreg Well, I'm not running such error. I'm asking about convention on using a package. However, I will improve the question. Thanks – Roberto Trunfio Nov 26 '12 at 16:58
We need just a minimal example for avoiding guessing at the needed packages and the algorithm you have in mind. It will be easier to give suggestions. – egreg Nov 26 '12 at 16:59
up vote 2 down vote accepted

I think you have the choice between three notations, with no real convention :

  • brackets (...) : in mathematics, that's the usual way to represent vectors through a coordinate list. Also, together with the square brackets below, it is an accepted notation for matrices. Both vectors and matrices are commonly represented as arrays when it comes to algorithms. On the other hand, they are also sometimes used to denote tuples, which have nothing to do with what you want to achieve;
  • square brackets [...] : there are many programming languages in which arrays (or lists) are represented with square brackets. Also, the same argument as above for matrices applies;
  • braces \{....\} : you should be careful with those. The usual mathematical meaning conveyed by braces is that they denote a set of element, that is a "pack of unordered elements". However, lists are a common way to represent such data structures in programming languages.

In my opinion, you should use braces only if the order of the elements in your list has no importance whatsoever. In any other case, you should stick to brackets or square brackets, with a preference for the latter.

Keep in mind that there is no real convention, so this is purely personal advice.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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