patchGNU Octave - Patches: patch #9129, wish: rewrite __tex2enhanced__()...


patch #9129: wish: rewrite __tex2enhanced__() of __gnuplot_draw_axes__.m to add color processing

Submitter:  Dan Sebald <sebald>
Submitted:  Sun 02 Oct 2016 08:50:01 PM UTC
Category:  Core : other Priority:  1 - Later
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Sun 02 Oct 2016 08:50:01 PM UTC, original submission:  

Currently gnuplot toolkit doesn't handle the "\color" TeX keyword to change color of individual items within a string.  However, it is possible to mimic such a thing in a roundabout way.  gnuplot enhanced text has a space command for which a string will not be displayed, but the point position advanced.  For example &{string so wide} will leave a blank space that "string so wide" would occupy.  With such a feature, it is possible to break a string into a series of strings.  Say that we want "Bold and Italic markup" to have "Bold" in red and "Italic" in green.  We could do it as follows:

set label 30 tc rgb "#BB0000" at -.9, 0.0 "{/:Bold Bold}"
set label 31 at -.9, 0.0 "&{/:Bold Bold} and"
set label 32 tc rgb "#00BB00" at -.9, 0.0 "&{{/:Bold Bold} and} {/:Italic Italic}"
set label 33 at -.9, 0.0 "&{{/:Bold Bold} and {/:Italic Italic}} markup"

So, in theory, the _tex2enhanced_() routine could return a cell of strings along with color RGBs that can be used to create the associated gnuplot label code.

Trying to do such a thing, I looked at the _tex2enhanced_() code and began to wonder if it couldn't be done easier with a recursive routine.  For example, currently there is a first pass to process the TeX codes, then a second pass to inject "@" for alignment.  Perhaps it might be easier if _tex2enhanced_() called itself when it finds another opening bracket.  Seems it should be, in my experience.

So the patch would be to redo _tex2enhanced_ for more simplicity and general handling of embedded \code{\code{\code{}}} sorts of syntax.  At the same time, create a series of strings for each color change.

Dan Sebald <sebald>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by sebald (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-ee12.
    Corresponding source code