-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
ansi colors are not defined in LaTeX output #77
Comments
this can easily be fixed with something like this in the latex preamble: \definecolor{ansi30}{HTML}{262626}
\definecolor{ansi31}{HTML}{D70000}
\definecolor{ansi32}{HTML}{5F8700}
\definecolor{ansi33}{HTML}{AF8700}
\definecolor{ansi34}{HTML}{0087FF}
\definecolor{ansi35}{HTML}{AF005F}
\definecolor{ansi36}{HTML}{00AFAF}
\definecolor{ansi37}{HTML}{E4E4E4}
\definecolor{ansi38}{HTML}{1C1C1C}
\definecolor{ansi39}{HTML}{D75F00}
\definecolor{ansi310}{HTML}{585858}
\definecolor{ansi311}{HTML}{626262}
\definecolor{ansi312}{HTML}{808080}
\definecolor{ansi313}{HTML}{5F5FAF}
\definecolor{ansi314}{HTML}{8A8A8A}
\definecolor{ansi315}{HTML}{FFFFD7} generated with: from ansi2html.style import SCHEME
sol = SCHEME['solarized']
for i, n in enumerate(sol):
print("\\definecolor{ansi3%s}{HTML}{%s}" % (i, n.strip('#').upper())) problematic is rather that which I fixed with the following sed in the meantime:
|
More than two years passed, and the problem is still here. Generating the
Here's the file in question: // Closures, lambda functions
#![allow(dead_code)]
use std::iter::Iterator;
pub type Weird2 = dyn Iterator<Item = i32>;
pub fn gen_iter() -> impl Iterator<Item = i32> {
(0..)
}
pub fn double_it(a: impl Iterator<Item = i32>) -> impl Iterator<Item = i32> {
a.map(|v| v + v)
}
pub fn sum_up(a: impl Iterator<Item = i32>) -> i32 {
let s = 0;
a.fold(s, |v, s| v + s)
}
pub fn take_more() {} Here's the generating command: $ bat --paging=never --color=always --style=full file1.rs | ansi2html -f 12 -L --scheme=osx > t.tex Here's the preamble manually added to
Here's the \documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{fancyvrb}
\usepackage[usenames,dvipsnames]{xcolor}
% \definecolor{red-sd}{HTML}{7ed2d2}
\definecolor{ansi30}{HTML}{000000}
\definecolor{ansi31}{HTML}{C23621}
\definecolor{ansi32}{HTML}{25BC24}
\definecolor{ansi33}{HTML}{ADAD27}
\definecolor{ansi34}{HTML}{492EE1}
\definecolor{ansi35}{HTML}{D338D3}
\definecolor{ansi36}{HTML}{33BBC8}
\definecolor{ansi37}{HTML}{CBCCCD}
\definecolor{ansi38}{HTML}{000000}
\definecolor{ansi39}{HTML}{C23621}
\definecolor{ansi310}{HTML}{25BC24}
\definecolor{ansi311}{HTML}{ADAD27}
\definecolor{ansi312}{HTML}{492EE1}
\definecolor{ansi313}{HTML}{D338D3}
\definecolor{ansi314}{HTML}{33BBC8}
\definecolor{ansi315}{HTML}{CBCCCD}
\title{}
\fvset{commandchars=\\\{\}}
\begin{document}
\begin{Verbatim}
\textcolor{ansi38-238}{───────┬────────────────────────────────────────────────────────────────────────}
\textcolor{ansi38-238}{│ }File: \textcolor{ansi1}{file1.rs}
\textcolor{ansi38-238}{───────┼────────────────────────────────────────────────────────────────────────}
\textcolor{ansi38-238}{ 1} \textcolor{ansi38-238}{│} \textcolor{ansi38-242}{//}\textcolor{ansi38-242}{ Closures, lambda functions}
\textcolor{ansi38-238}{ 2} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{#!}\textcolor{ansi38-231}{[}\textcolor{ansi38-231}{allow}\textcolor{ansi38-231}{(}\textcolor{ansi38-231}{dead_code}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{]}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 3} \textcolor{ansi38-238}{│} \textcolor{ansi38-203}{use}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{std}\textcolor{ansi38-231}{::}\textcolor{ansi38-231}{iter}\textcolor{ansi38-231}{::}\textcolor{ansi38-231}{Iterator}\textcolor{ansi38-231}{;}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 4} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 5} \textcolor{ansi38-238}{│} \textcolor{ansi38-203}{pub}\textcolor{ansi38-231}{ }\textcolor{ansi38-81}{type}\textcolor{ansi38-231}{ }\textcolor{ansi38-149}{Weird2}\textcolor{ansi38-231}{ }\textcolor{ansi38-203}{=}\textcolor{ansi38-231}{ dyn }\textcolor{ansi38-231}{Iterator}\textcolor{ansi38-231}{<}\textcolor{ansi38-231}{Item = }\textcolor{ansi38-81}{i32}\textcolor{ansi38-231}{>}\textcolor{ansi38-231}{;}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 6} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 7} \textcolor{ansi38-238}{│} \textcolor{ansi38-203}{pub}\textcolor{ansi38-231}{ }\textcolor{ansi38-81}{fn}\textcolor{ansi38-231}{ }\textcolor{ansi38-149}{gen_iter}\textcolor{ansi38-231}{(}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{->}\textcolor{ansi38-231}{ impl }\textcolor{ansi38-231}{Iterator}\textcolor{ansi38-231}{<}\textcolor{ansi38-231}{Item = }\textcolor{ansi38-81}{i32}\textcolor{ansi38-231}{>}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{{}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 8} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{ }\textcolor{ansi38-231}{(}\textcolor{ansi38-141}{0}\textcolor{ansi38-203}{..}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 9} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 10} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 11} \textcolor{ansi38-238}{│} \textcolor{ansi38-203}{pub}\textcolor{ansi38-231}{ }\textcolor{ansi38-81}{fn}\textcolor{ansi38-231}{ }\textcolor{ansi38-149}{double_it}\textcolor{ansi38-231}{(}\textcolor{ansi38-208}{a}\textcolor{ansi38-231}{:}\textcolor{ansi38-231}{ impl }\textcolor{ansi38-231}{Iterator}\textcolor{ansi38-231}{<}\textcolor{ansi38-231}{Item = }\textcolor{ansi38-81}{i32}\textcolor{ansi38-231}{>}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{->}\textcolor{ansi38-231}{ impl }\textcolor{ansi38-231}{Iterator}\textcolor{ansi38-231}{<}\textcolor{ansi38-231}{Item = }\textcolor{ansi38-81}{i32}\textcolor{ansi38-231}{>}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{{}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 12} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{ a}\textcolor{ansi38-231}{.}\textcolor{ansi38-81}{map}\textcolor{ansi38-231}{(}\textcolor{ansi38-231}{|}\textcolor{ansi38-208}{v}\textcolor{ansi38-231}{|}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{v }\textcolor{ansi38-203}{+}\textcolor{ansi38-231}{ v}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 13} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 14} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 15} \textcolor{ansi38-238}{│} \textcolor{ansi38-203}{pub}\textcolor{ansi38-231}{ }\textcolor{ansi38-81}{fn}\textcolor{ansi38-231}{ }\textcolor{ansi38-149}{sum_up}\textcolor{ansi38-231}{(}\textcolor{ansi38-208}{a}\textcolor{ansi38-231}{:}\textcolor{ansi38-231}{ impl }\textcolor{ansi38-231}{Iterator}\textcolor{ansi38-231}{<}\textcolor{ansi38-231}{Item = }\textcolor{ansi38-81}{i32}\textcolor{ansi38-231}{>}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{->}\textcolor{ansi38-231}{ }\textcolor{ansi38-81}{i32}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{{}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 16} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{ }\textcolor{ansi38-81}{let}\textcolor{ansi38-231}{ s }\textcolor{ansi38-203}{=}\textcolor{ansi38-231}{ }\textcolor{ansi38-141}{0}\textcolor{ansi38-231}{;}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 17} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{ a}\textcolor{ansi38-231}{.}\textcolor{ansi38-81}{fold}\textcolor{ansi38-231}{(}\textcolor{ansi38-231}{s}\textcolor{ansi38-231}{,}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{|}\textcolor{ansi38-208}{v}\textcolor{ansi38-231}{,}\textcolor{ansi38-231}{ }\textcolor{ansi38-208}{s}\textcolor{ansi38-231}{|}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{v }\textcolor{ansi38-203}{+}\textcolor{ansi38-231}{ s}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 18} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 19} \textcolor{ansi38-238}{│} \textcolor{ansi38-231}{}
\textcolor{ansi38-238}{ 20} \textcolor{ansi38-238}{│} \textcolor{ansi38-203}{pub}\textcolor{ansi38-231}{ }\textcolor{ansi38-81}{fn}\textcolor{ansi38-231}{ }\textcolor{ansi38-149}{take_more}\textcolor{ansi38-231}{(}\textcolor{ansi38-231}{)}\textcolor{ansi38-231}{ }\textcolor{ansi38-231}{{}\textcolor{ansi38-231}{}}\textcolor{ansi38-231}{}
\textcolor{ansi38-238}{───────┴────────────────────────────────────────────────────────────────────────}
\end{Verbatim}
\end{document} |
@ralphbean ping? Would you be able to address this issue? |
When converting to LaTeX in non-inline mode,
ansi2html
produces commands like\textcolor{ansi33}
, althoughansi*
colors are not defined.Maybe just use
\textcolor[HTML]{aa5500}
like in inline mode?The text was updated successfully, but these errors were encountered: