-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASCII colors not quite properly printed in LaTeX #1945
Comments
This seems tricky to do, because it looks like the formatting commands don't get written to the IO buffer: (image to see the formatting) julia> printstyled("Hello"; bold = true)
Hello
julia> printstyled(stdout, "Hello"; bold = true)
Hello
julia> io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)
julia> printstyled(io, "Hello"; bold = true)
julia> String(take!(io))
"Hello" |
You need to do: julia> io = IOBuffer()
julia> ioc = IOContext(io, :color=>true)
julia> printstyled(ioc, "Hello"; bold = true)
julia> String(take!(io))
"\e[0m\e[1mHello\e[22m" |
So then the follow-up question is: can the \begin{minted}{julia}
julia> io = IOBuffer()
julia> ioc = IOContext(io, :color=>true)
julia> printstyled(ioc, "Hello"; bold = true)
julia> String(take!(io))
"\e[0m\e[1mHello\e[22m"
\end{minted} yields |
Would need to do the same as the HTML code does (parse it and render). See #1441, https://github.com/JuliaDocs/ANSIColoredPrinters.jl I am not sure you can directly set colors for certain parts of a minted block. Perhaps to fix this perfectly one would need to render directly to latex code for code blocks without relying on any package. |
\begin{minted}[escapeinside=@@]{jlcon}
julia> src = IOBuffer("Is \e[48;5;250mthis \e[38;5;198mword \e[mcolored?");
@@
julia> LaTeXPrinter(src)
@Is \colorbox[HTML]{bcbcbc}{this {\color[HTML]{ff0087}word }}colored?@
\end{minted}
|
From the LaTeX showcase PDF:
The text was updated successfully, but these errors were encountered: