8

In order to prepare my math notes in LaTeX I need to combine two existing symbols, \langle (or \rangle) with a vertical bar.

Temporarily I am using a command invented by myself: \newcommand{\disk}[2]{\mathrel{\langle\mkern-3.85mu\mid\mkern-4mu} {#1} \mathrel{\mkern-4mu\mid\mkern-3.85mu\rangle}_{#2}}, but the results don't satisfy me. I want to use it as a pair of brackets, unfortunately spacing is poor: \[\mu(\disk{a}{n}) = \sum_{k = 0}^{p-1} \mu (\disk{a + kp^n}{n+1})\] compiles to

enter image description here

As I suspect, there must be a TeX command to define custom brackets. How can I achieve this?

  • 6
    There is a \DeclarePairedDelimiter command in mathtools package -- you should use that one, I think -- but from a personal point of view: Your 'brackets' do not really look nice, like squeezed triangles – user31729 Aug 10 '16 at 11:00
  • 3
    Just curious: what is the advantage of this notation over using a good-old-fashioned function, like f_n(a), f_{n+1}(a+kp^n)? – Matsmath Aug 10 '16 at 11:02
  • @Matsmath here \langle a \rangle_n denotes the set a + p^n \Z_p and \mu is some unknown function whose properties I investigate. – Santiago Aug 10 '16 at 11:09
  • @ChristianHupfer, I have also tried using \triangleleft as a delimiter, but it does not scale vertically well. – Santiago Aug 10 '16 at 11:11
  • 1
    The problem with that delimiter is that it is not easily extensible, if you want it on a fractional term. If you don't need it extensible, I would use \triangleleft and \trangleright and use \scalebox{.5}[1] to compress it (numbers may vary). – Steven B. Segletes Aug 10 '16 at 11:35
4

While I use scalerel to scale the symbols, I only scale them to the size of [ and ], rather than with arbitrary stretch. Here, I just use \triangleleft and \triangleright as the base shapes.

EDITED to use \mathopen and \mathclose, instead of \mathinner.

\documentclass[11pt]{article}
\usepackage{amsmath,scalerel}
\newcommand\langlebar{\mathopen{\scalerel*[.55ex]{\triangleleft\mkern3mu}{[}}}
\newcommand\ranglebar{\mathclose{\scalerel*[.55ex]{\mkern3mu\triangleright}{]}}}
\begin{document}
\[\mu(\langlebar a\ranglebar_n) = \sum_{k = 0}^{p-1} \mu (
  \langlebar a + kp^n\ranglebar_{n+1})\] 
\end{document}

enter image description here

| improve this answer | |
  • Why \mathinner? – GuM Aug 10 '16 at 11:56
  • @GustavoMezzetti I wasn't sure what was appropriate, so I looked at Knuth's TeXbook, where he says that \mathinner is used for \left \right symbols, if I understood it correctly. – Steven B. Segletes Aug 10 '16 at 11:58
  • OP want's to use the brackets like they were actual brackets, i.e. \left\langlebar ... \right\ranglebar. Also, the second argument of \disk should appear as index. – Henri Menke Aug 10 '16 at 12:02
  • 1
    No, I’d go for \mathopen and \mathclose, here. But, of course, the “right” answer is Henri Menke’s. – GuM Aug 10 '16 at 12:25
  • @GustavoMezzetti Thanks. Revised for that, though I needed extra \mkern. I agree Henri's answer is "right". – Steven B. Segletes Aug 10 '16 at 14:09
8

The MnSymbol package has your desired symbols as \langlebar and \ranglebar. They also work with \left and \right.

\documentclass{article}
\usepackage{MnSymbol}
\begin{document}
\[\mu(\langlebar a \ranglebar_{n}) = \sum_{k = 0}^{p-1} \mu (\langlebar a + kp^n \ranglebar_{n+1})\]
\end{document}

enter image description here

As you can see it also changes other symbols. If you don't want to use the entire MnSymbol package but only these brackets, you have to include the relevant parts in your document.

\documentclass{article}
\DeclareFontFamily{OMX}{MnSymbolE}{}
\DeclareFontShape{OMX}{MnSymbolE}{m}{n}{
    <-6>  MnSymbolE5
   <6-7>  MnSymbolE6
   <7-8>  MnSymbolE7
   <8-9>  MnSymbolE8
   <9-10> MnSymbolE9
  <10-12> MnSymbolE10
  <12->   MnSymbolE12}{}
\DeclareFontShape{OMX}{MnSymbolE}{b}{n}{
    <-6>  MnSymbolE-Bold5
   <6-7>  MnSymbolE-Bold6
   <7-8>  MnSymbolE-Bold7
   <8-9>  MnSymbolE-Bold8
   <9-10> MnSymbolE-Bold9
  <10-12> MnSymbolE-Bold10
  <12->   MnSymbolE-Bold12}{}

\DeclareSymbolFont{MnSymbol}{OMX}{MnSymbolE}{m}{n}
\SetSymbolFont{MnSymbol}{bold}{OMX}{MnSymbolE}{b}{n}

\DeclareMathDelimiter{\langlebar}{\mathopen}{MnSymbol}{'152}{MnSymbol}{'152}
\DeclareMathDelimiter{\ranglebar}{\mathclose}{MnSymbol}{'157}{MnSymbol}{'157}
\begin{document}
\[\mu(\langlebar a \ranglebar_{n}) = \sum_{k = 0}^{p-1} \mu (\langlebar a + kp^n \ranglebar_{n+1})\]
\end{document}

enter image description here


In unicode-math such a symbol is available but not in every font. We have to load it using the range option from, e.g., XITS Math.

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range={\llangle,\rrangle}]{XITS Math}
\begin{document}
\[\mu(\llangle a \rrangle_{n}) = \sum_{k = 0}^{p-1} \mu (\llangle a + kp^n \rrangle_{n+1})\]
\end{document}

enter image description here

| improve this answer | |
  • 1
    a comment about the naming of these brackets in the xits/stix fonts: somehow the fact was overlooked that the names \llangle and \rrangle had been used earlier in the st mary road fonts for doubled angle brackets, and that assignment should have had priority. there may be an attempt to rectify this unfortunate situation, but there are other ramifications that need to be researched first. just a friendly warning. – barbara beeton Aug 10 '16 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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