Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

Re: bold color text and export to file

by pvaldes (Chaplain)
on Sep 22, 2014 at 20:10 UTC ( [id://1101565] : note . print w/replies, xml ) Need Help??

in reply to bold color text and export to file

color output was difficult to save in text file

You can do it. It depends of the desired output format... want a yummy pdf?

my $dna = "AAAAAACAAACAAACCCAATATATATATACGACATATATTATATATTATACCCCGGG"; my $preciouss = substr $dna, 15, 28; open (my $output, '>', "latex_file.tex"); print $output "\\documentclass{article}\n\\usepackage{color}\n"; print $output "\\begin{document}\n"; print $output "THIS IS MY BORING GENE: \\textcolor{red}{", $preciouss, + "}\\\\\\textcolor{blue}{OKAY, OKAY... \\textit{NOT SO BORING}, {\\bf + IS RED!}}"; print $output "\n\\end{document}"; close $output; system("pdflatex latex_file.tex"); system("xpdf latex_file.pdf &");

You will need to have installed a decent tex distro and xpdf. See texlive. You can also translate to html, dvi or postscript easily from here, as you will

Update: typo fixed in textit and new link