Want to use double square bracket


I want to use a double square bracket in my plots. For that purpose, I use \llbracket in my latex. Does matplotlib also support \llbracket? I tried using

ax.set_ylabel(r"$\llbracket p \rrbracket$ [N/m$^2$] "

But I got the error saying

! Undefined control sequence.

l.29 {\rmfamily \llbracket p [N/m$^2$]}%

Does anyone have any suggestions?


You need to tell matplotlib to load the latex package that defines your \llbracket command eg:

import matplotlib.pyplot as plt

plt.rc('text', usetex=True)
plt.rc('text.latex', preamble=r'\usepackage{<latex_package_name_here>}')

If this is a custom latex command, just paste your definition in the preamble string.

Thank you. I was trying to load a latex package. But my syntax was wrong. Now I can add labels with double square brackets.