visual-studio-codejulialatexjupyterdocstring

Julia docstrings not rendered properly to VS Code (via LaTeX?)


I am new to the Julia language and trying out docstrings in a VSCode Jupyter notebook

"""
    fibonacci(n)

Calculate the Fibonacci sequence up to the nth number.

# Arguments
- `n`: The position in the Fibonacci sequence to calculate up to. Must be a positive integer.

# Returns
- An array containing the Fibonacci sequence up to the nth number.
"""
function fibonacci(n)
    fib_sequence = zeros(Int, n)
    fib_sequence[1] = 0
    fib_sequence[2] = 1
    for i = 3:n
        fib_sequence[i] = fib_sequence[i - 1] + fib_sequence[i - 2]
    end
    return fib_sequence
end

Apparently the docstring gets turned into LaTeX and then cannot be correctly displayed.

output cell

How to fix this? Is this a Julia issue, a Jupyter or a VSCode one?


Solution

  • Per this issue, you can fix this by clicking the three dots on the cell, then changing presentation from text/latex to text/markdown.

    enter image description here