Right now I'm doing some math homework that has lots of ordered pairs. Being lazy, I got tired of writing \langle x, y \rangle and so I was wondering if there's a way to define a command, say \ordered, that receives parameters x, y and returns \langle x, y \rangle . For example \ordered{1, 3} would return enter image description here.

Thanks in advance!


2 Answers 2


Just do

\newcommand{\ordered}[1]{\langle #1\rangle}

which will also cover ordered triples, quadruples and so on. You can do


and the output would be as expected.

It's not just laziness! Suppose at some point your coauthor tells you that angle brackets are awful and round parentheses must be used (you're not in the position to contradict your coauthor). Having a command for the thing is the best, because you comply with the diktat by modifying into


and recompile. But maybe your coauthor has a different idea: use semicolons instead of colons.

Not a big deal: change the code into

  \langle % or (, maybe
  \clist_use:nn { #1 } { ; }
  \rangle % or ), maybe

and recompile. No change at all in the document input.

Explanation: you need \ExplSyntaxOn to access the expl3 programming layer; \NewDocumentCommand is better in this context, but also \newcommand{\ordered}[1] would do. With \clist_use:nn we tell LaTeX to digest a comma separated list of items and deliver it with semicolons in between items.

  • I think any solution like this should include an interface for scaling the brackets.
    – Gaussler
    Jul 28, 2022 at 6:37
  • @Gaussler I don't think this is needed for the particular case of ordered tuples.
    – egreg
    Jul 28, 2022 at 8:16
  • Depends on the vertical size of what you are ordering.
    – Gaussler
    Jul 28, 2022 at 8:17

Just do

\def\ordered#1{\langle #1\rangle}

This defines a macro \ordered with one parameter #1. If you use e.g. \ordered{1,3} then the parameter #1 is 1,3 and the macro expands to \langle 1,3\rangle.

You must log in to answer this question.

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