Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is it possible to markup (i.e. highlight or underline) text in a deployed cdf file and then save it? I think I know the answer (no), but since it seems a basic necessity for a document format that aspires to be used for textbooks, I thought I would ask if anybody had succeeded in such a task. Other similar tasks might include margin notes.

I have tried a little out myself and failed with the following code:

    highlight :=  
      SetOptions[NotebookSelection[EvaluationNotebook[]], Background -> Yellow];
    highlightButton := Button["Highlight", highlight];
    SetOptions[EvaluationNotebook[], 
     DockedCells -> Cell[BoxData[ToBoxes[highlightButton]], "DockedCell"]]

When this is executed in Mathematica, I get a nice Button in my DockedCell that allows me to highlight text, by first selecting the text and then hitting the button. However, this functionality disappears when I try to deploy as a CDF.

Am I right that this is impossible? I am pretty sure that even if I managed to get the text highlighted, from CDF Player, there won't be any saving anyway, but at least it could be printed (perhaps to a pdf).

share|improve this question

1 Answer 1

Yes and no: Any alteration of the notebook by SetOptions seems to be inhibited (and that is probably fine). However, if you use Dynamic in advance for highlighting say a Text cell, then it works, even printing the highlighted cell to PDF. Try this:

highlightButton := Button["Highlight", color = RGBColor[1, 1, 0]];
unhighlightButton := Button["UnHighlight", color = RGBColor[1, 1, 1]];
SetOptions[EvaluationNotebook[], 
  DockedCells -> 
   Cell[BoxData[
     RowBox[{ToBoxes[highlightButton], ToBoxes[unhighlightButton]}]], 
    "DockedCell"]];
CellPrint@Cell["CDF is really easy!", "Text",
   Background -> Dynamic[color]]
share|improve this answer
    
That certainly makes it possible for the user to switch back and forth, but it is not exactly what I am after. I would like to have the end-user have the ability to mark up sections that are of interest to him/her as they would be able to a printed book. My end use is a small textbook that I am in the throes of writing, and since it relies on extensive Dynamic interactivity, the printed version will lack substantially. What I would like to be able to do is have users be able to mark it up like they would the printed version. –  Andy Mobley Mar 9 at 8:44
    
Call Wolfram Research and ask them to add this to the next version of CDF. –  Rolf Mertig Mar 9 at 8:57
    
That is a good idea. Maybe others would have some ideas of similar types of behavior that would be good to ask for. –  Andy Mobley Mar 9 at 11:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.