How to use cases in docstring math mode?

I think it’s failing because you’re not escaping the line break backslashes on line 3 (you want \\, so you’d need to write \\\\ to escape them properly in a docstring). I.e.:

```math
b = \\begin{cases}
1 & a>0, \\\\
0 & \\text{otherwise}
\\end{cases}
```

However, you should actually be able to avoid the escaping altogether by using the raw"" string macro:

@doc raw"""
```math
b = \begin{cases}
1 & a>0, \\
0 & \text{otherwise}
\end{cases}
```
"""
function foo end
3 Likes