Latex not rendering in html, stdout output (such as plots, widgets, etc) for Python and Julia notebooks
See original GitHub issueHow are you mainly using the Jupyter extension?
- Notebooks (.ipynb)
- Interactive Window and or Cell Scripts (ex. .py files with #%%)
- Both
What happened?
I wrote ?rand
(for example) in a Julia notebook cell and executed the cell. The output of the cell was very difficult to read, as it appears to be unrendered LaTeX with strange coloring:
\begin{verbatim} rand([rng=GLOBAL_RNG], [S], [dims…]) \end{verbatim} Pick a random element or array of random elements from the set of values specified by \texttt{S}; \texttt{S} can be \begin{itemize} \item an indexable collection (for example \texttt{1:9} or \texttt{(‘x’, “y”, 😒)}),
What flavor of VS Code are you using?
Stable
Jupyter Extension Version
v2021.8.2041215044
Jupyter logs
\begin{verbatim}
rand([rng=GLOBAL_RNG], [S], [dims...])
\end{verbatim}
Pick a random element or array of random elements from the set of values specified by \texttt{S}; \texttt{S} can be
\begin{itemize}
\item an indexable collection (for example \texttt{1:9} or \texttt{('x', "y", :z)}),
\item an \texttt{AbstractDict} or \texttt{AbstractSet} object,
\item a string (considered as a collection of characters), or
\item a type: the set of values to pick from is then equivalent to \texttt{typemin(S):typemax(S)} for integers (this is not applicable to \href{@ref}{\texttt{BigInt}}), to $[0, 1)$ for floating point numbers and to $[0, 1)+i[0, 1)$ for complex floating point numbers;
\end{itemize}
\texttt{S} defaults to \href{@ref}{\texttt{Float64}}. When only one argument is passed besides the optional \texttt{rng} and is a \texttt{Tuple}, it is interpreted as a collection of values (\texttt{S}) and not as \texttt{dims}.
\begin{quote}
\textbf{compat}
Julia 1.1
Support for \texttt{S} as a tuple requires at least Julia 1.1.
\end{quote}
\section{Examples}
\begin{verbatim}
julia> rand(Int, 2)
2-element Array{Int64,1}:
1339893410598768192
1575814717733606317
julia> using Random
julia> rand(MersenneTwister(0), Dict(1=>2, 3=>4))
1=>2
julia> rand((2, 3))
3
julia> rand(Float64, (2, 3))
2×3 Array{Float64,2}:
0.999717 0.0143835 0.540787
0.696556 0.783855 0.938235
\end{verbatim}
\begin{quote}
\textbf{note}
Note
The complexity of \texttt{rand(rng, s::Union\{AbstractDict,AbstractSet\})} is linear in the length of \texttt{s}, unless an optimized method with constant complexity is available, which is the case for \texttt{Dict}, \texttt{Set} and \texttt{BitSet}. For more than a few calls, use \texttt{rand(rng, collect(s))} instead, or either \texttt{rand(rng, Dict(s))} or \texttt{rand(rng, Set(s))} as appropriate.
\end{quote}
\rule{\textwidth}{1pt}
\begin{verbatim}
rand([rng::AbstractRNG,] s::Sampleable)
\end{verbatim}
Generate one sample for \texttt{s}.
\begin{verbatim}
rand([rng::AbstractRNG,] s::Sampleable, n::Int)
\end{verbatim}
Generate \texttt{n} samples from \texttt{s}. The form of the returned object depends on the variate form of \texttt{s}:
\begin{itemize}
\item When \texttt{s} is univariate, it returns a vector of length \texttt{n}.
\item When \texttt{s} is multivariate, it returns a matrix with \texttt{n} columns.
\item When \texttt{s} is matrix-variate, it returns an array, where each element is a sample matrix.
rand([rng::AbstractRNG,] s::Sampleable, dim1::Int, dim2::Int...) rand([rng::AbstractRNG,] s::Sampleable, dims::Dims)
\end{itemize}
Generate an array of samples from \texttt{s} whose shape is determined by the given dimensions. \rule{\textwidth}{1pt}
\begin{verbatim}
rand(rng::AbstractRNG, d::UnivariateDistribution)
\end{verbatim}
Generate a scalar sample from \texttt{d}. The general fallback is \texttt{quantile(d, rand())}. \rule{\textwidth}{1pt}
\begin{verbatim}
rand(rng, d)
\end{verbatim}
Extract a sample from the p-Generalized Gaussian distribution 'd'. The sampling procedure is implemented from from [1]. [1] Gonzalez-Farias, G., Molina, J. A. D., \& Rodríguez-Dagnino, R. M. (2009). Efficiency of the approximated shape parameter estimator in the generalized Gaussian distribution. IEEE Transactions on Vehicular Technology, 58(8), 4214-4223. \rule{\textwidth}{1pt}
\begin{verbatim}
rand(::AbstractRNG, ::Distributions.AbstractMvNormal)
\end{verbatim}
Sample a random vector from the provided multi-variate normal distribution. \rule{\textwidth}{1pt}
\begin{verbatim}
rand(::AbstractRNG, ::Sampleable)
\end{verbatim}
Samples from the sampler and returns the result. \rule{\textwidth}{1pt}
\begin{verbatim}
rand(d::Union{UnivariateMixture, MultivariateMixture})
\end{verbatim}
Draw a sample from the mixture model \texttt{d}.
\begin{verbatim}
rand(d::Union{UnivariateMixture, MultivariateMixture}, n)
\end{verbatim}
Draw \texttt{n} samples from \texttt{d}.
What coding language are you working with?
Julia
VS Code Version?
1.60.1
Python Extension Version
No response
Python Version
No response
Anaconda Version
No response
What OS are you running on?
Mac
Running Jupyter locally or remotely?
Local
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:20 (15 by maintainers)
Top Results From Across the Web
Latex not rendering in html, stdout output (such as plots ...
This is something that Jupyter supports so it should be supported in VS code (otherwise people can't open notebooks generated with Jupyter).
Read more >latex jupyter notebook it does not work - Stack Overflow
In the Jupyter Notebook, this magic only renders the subset of latex defined by MathJax here. You must run the cell to display...
Read more >Jupyter Notebooks — Python productivity for Zynq (Pynq)
The Jupyter Notebook is an interactive computing environment that enables users to author notebook documents that include: Live code; Interactive widgets; Plots ......
Read more >1 Jupyter / IPython notebook hints and tips
IPython uses MathJax to render LaTeX, as in $y=ax^2+bx+c$. ... The only problem is that HTML does not print very well, especially with...
Read more >nbconvert Documentation - Read the Docs
Using nbconvert enables: • presentation of information in familiar formats, such as PDF. • publishing of research using LaTeX and opens the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is something that Jupyter supports so it should be supported in VS code (otherwise people can’t open notebooks generated with Jupyter).
Thanks for the bug. It looks like the output is not being converted by VS code to the latex form.
Jupyter shows this for me:
VS code shows this: