Skip to content

demo of new feature: alternate line color #8

@muzimuzhi

Description

@muzimuzhi

The purpose of this feature is to let odd- and even lines have different highlight colors. I have committed a demo implementation to my forked repo. Only sty file is changed in that commit.

Some Explanations

  1. Now highlightcolor can be used as highlightcolor = SingleColor | {<OddLineColor>, <EvenLineColor>}.
  2. New option highlightlinenumbercolor changes the highlight color of line number, and this option can be used the same as highlightcolor.
  3. Since calculating the max width of actual line number (\arabic{FancyVerbLine}) is hard, a new option linenumberwidth=<dimen> is defined.
  4. If breaklines=true, the total heigh of a line is not determined until \FV@SaveLineBox. Therefore \FV@LeftListNumber (with its background) is typeset after \FancyVerbFormatLine.

Shortcut:

  1. \def\FV@LineNumberBackground{} is a compromise since \def\FV@LineNumberBackground\@empty and \def\FV@LineNumberBackground\relax both raise error. I guess it is a problem of order of macro expanding.
  2. The \pickTwo macro may have nicer implementation.

I am not fully understood about packages fancyvrb and fvextra, so any suggestions are helpful. And, more test is needed of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions