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.

Upon building documentation in Workbench, Workbench sometimes converts the output of examples on function pages into rasterized images, and sometimes not. Does anybody know what controls this behavior?

For example, say if we have a package containing the following code:

MakeBoxes[tensor, StandardForm] = InterpretationBox[
    StyleBox@GridBox[
        {{
            "T", 
            StyleBox@GridBox[{{"a"}, {"b"}}]
        }}, 
        ColumnSpacings -> 0.05
    ], 
    tensor
];

TestSymbol[n_] := Table[tensor, {n}];

And let the documentation notebook of TestSymbol contain the following examples:

TestSymbol[1]
TestSymbol[2]
TestSymbol[3]
TestSymbol[4]
TestSymbol[5]
TestSymbol[6]

The output of the first 5 examples are left untouched by the documentation build process, but somehow output of the 6th gets rasterized. (And for any TestSymbol[n], with n > 5 for that matter).

The culprit seems to be the ColumnSpacings option; if I remove that then none of the output gets rasterized.

I tried digging through the documentation tools source code, but unfortunately that was like searching for a needle in a haystack. Does anybody have a clue what's causing this behavior?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Turns out the ColumnSpacings was a red herring; instead, the deciding factor here is notebook file size. From the source of Common.m of the Documentation Tools:

(* Here we shrink notebooks by converting graphics to bitmaps (but only if the resulting
   bitmap is smaller than the original Graphics expression). Also, as an optimization
   for the time it takes for this conversion process, only operate on notebooks that
   are at least a certain size. This process modifies the notebooks in place.
*)

This comment is right above the function that does the actual rasterization, ConvertGraphicsToBitmaps. If we replace it with

ConvertGraphicsToBitmaps[nb_NotebookObject, entityType_] := Null;

then no output cells are rasterized anymore.

share|improve this answer
add comment

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.