Re: Color coding text lines in a document



"yasirniazkhan" <yasir.niaz@xxxxxxxxx> writes:
Hi, i want to make a template which color codes the text lines of
documents that include this template. For example, all odd lines of
the document become red and all even lines of the document become
blue. I have used /color{red} to color the whole document, but how to
color alternate lines differently?

tex as a general rule doesn't "know" about lines as separate entities;
the basic entity is the paragraph, which is compiled as a horizontal
box and split into lines, which are then assembled into a vertical
box. unfortunately, afaik, that process is in essence a "primitive"
operation, and you can't interfere with it.

the totally simple way of doing the job is to put the whole document
into a huge longtable (one line of document per row), and to use the
standard trivial techniques to cycle through colours for each row.
the (?killing) downside of this is that you have to do the line
breaking for yourself.

an outside bet might be the omega "running quote" mechanism. that's
intended for putting quote marks to the left of each line of an
extended quote. i imagine it's possible that one could change colour
in those (so to speak) marks; i would not be surprised to be told
that's not possible.

it's also just possible that the flowfram package could be abused to
do this (lots of one-line boxes strung together, each primed with a
colour command, somehow). it would be extremely tiresome to set it
up, and i really don't know if it would work.

lastly, may i register the fact that i'm extremely pleased i'm
unlikely to need to read your final result. indeed, it seems to me
_so_ counter-typographical that i wonder whether you might not do
better to switch to word.
--
Robin Fairbairns, Cambridge
.



Relevant Pages

  • Re: Using a variable in a formula
    ... As for the quote marks... ... > Thanks Rick. ... Works great with quote marks, ... >>> formula needs to move to the Feb 08 sheets, ...
    (microsoft.public.excel.programming)
  • Quotes(" or ) (was:The power that is C++)
    ... double quote marks to identify spoken bits. ... name of a character is the name of the thing with two marks ... that you use apostrophe to quote things in this sense doesn't ...
    (comp.lang.fortran)
  • Re: Replacing a string in a filename
    ... I've been trying to find a definite resource for Windows version of Sed and it's been slow going. ... Putting quote marks in gives me syntax errors. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Replacing a string in a filename
    ... >>> Ampersand seperates commands on one line. ... Putting quote marks in gives me syntax errors. ... Pement's SED One-liners is a mine of useful information. ...
    (microsoft.public.win2000.cmdprompt.admin)

Loading