6
$\begingroup$

I am working on formatting a cell for a slideshow presentation format such that a graphics object occupies the left half of the cell and bullets or other items occupy the right. The ancient AuthorTools functions are not sufficiently documented for me to determine if this is possible with bilateral cells, but the first attempt below is my stripped down version of ToBilateral

CellPrint@Cell[BoxData@GridBox[
    {{
      Cell[BoxData[ToBoxes[Plot[Sin[x], {x, 0, 2 Pi}]]], "Output"],
      GridBox[{
        {Cell["section", "Section"]},
        {Cell["subsection", "Subsection"]},
        {Cell["item", "Item"]}
        }, ColumnAlignments -> Left]
      }}, ColumnSpacings -> 3, RowAlignments -> Top]]

gives the following output with the default stylesheet

Mathematica graphics

Boxing in Mathematica can leave you punch drunk very quickly, so I reverted to Row and Column to get this

Row[
 {Plot[Sin[x], {x, 0, 2 Pi}, ImageSize -> 300],
  Column[{
    Style["section", "Section"],
    Style["subsection", "Subsection"],
    Style["item", "Item"]
    }, Left, 2]
  }, "\t"]

Mathematica graphics

In both cases the dingbat for the item style gets eaten and there is no style indenting. I attempted to edit the stylesheet and navigate to the options inspector; however changes made there have no effect on the output of either of these code snippets unless the formatting change is related to font color, size, weight, etc. Oddly enough, the framestyle for a section does appear in the Cell snippet but not in the Row/Column snippet.

To be clear, I'm looking for something like this:

Mathematica graphics

which I've only been able to obtain with the following code:

LoadMicrosoftPowerPoint[]
CutandPaste[]

so I'm looking for a better solution.

$\endgroup$
3
  • 1
    $\begingroup$ You may find this related: two column layout. Mr. Wizard's link too. $\endgroup$
    – Kuba
    Sep 2, 2013 at 22:09
  • $\begingroup$ Thanks @kuba I should list the links that I have already reviewed to save folks some time. That one was new to me. $\endgroup$ Sep 2, 2013 at 22:11
  • $\begingroup$ @bobthechemist I recall that the package "Presentations" of David Park enables to do that routinely. You might like to check this: home.comcast.net/~djmpark $\endgroup$ Sep 3, 2013 at 7:16

1 Answer 1

1
$\begingroup$

Here's what I've come up with so far to address this problem. Ultimately, I want two columns where one column is a set of bullets and the other column is any type of object. I have a hack of a solution by making two functions. The first makes bullets and the second makes the two columns. Please pardon the code:

Clear[bulletbox]
bulletbox[s_List] := Module[{
   t, bul = {"+ ", "- ", "~ "}, 
   level = 1 + (Max@StringPosition[#, "$"] & /@ 
        s /. {-\[Infinity] -> 0}),
   style = {"Section", "Subsection", "Subsection", "Item"}
   },
  t = MapThread[StringInsert[#1, bul[[#2]], #2] &, {s, level}];
  t = Map[StringReplace[#, "$" -> "\t"] &, t];
  t = MapThread[Style[#1, style[[#2]]] &, {t, level}];
  t = GridBox[{Map[Cell[#, TabSpacings -> {2}] &, t]} // Transpose, 
    ColumnAlignments -> Left];
  t
  ]

Clear[twocol];
twocol[left_, right_] := Module[{lmod, rmod},
  rmod = right;
  lmod = If[left[[0]] === Cell, left, Cell[BoxData[ToBoxes[left]]]];

  CellPrint@
   Cell[BoxData@GridBox[{{
        lmod,
        rmod
        }}, ColumnSpacings -> 3, RowAlignments -> Top], 
    CellMargins -> {{50, 3}, {4, 4}}]]

The bullet function grabs the formatting options of the stylesheet for sections and subsections so hopefully the bullets maintain some type of style consistency with the rest of the notebook. Results look like:

twocol[Manipulate[Plot[Sin[a x], {x, 0, 2 Pi}], {a, 1, 10}], 
 bulletbox[{"A Manipulate tool", "$interactive graphics", 
   "$$Easy to make", "Two column output", "$Desired feature", 
   "$$Nontrivial to make"}]]

enter image description here

Perhaps the biggest problem with this approach is that cells generated using this function don't seem to like SEUploader! (and those of you paying attention will note that I did change the bullet icons...)

Any comments would be appreciated. There is no doubt that the bulletbox function is poorly written, but I needed something since my presentation is a few days away.

$\endgroup$
1
  • $\begingroup$ Note this is proof of concept. What I have for converting normal input cells to boxes is insufficient (and absent for the right column). $\endgroup$ Sep 5, 2013 at 2:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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