2
$\begingroup$

I am currently starting to develop a Web API for our schools mathematics placement examination for new students. We have the questions and we have what potential scores will mean for us. After tinkering around with this for a while I have developed several questions:

  1. I currently use a personally defined stylesheet for most things and want this stylesheet to be the basis for all aesthetics associated to our cloud objects. Even if I deploy the entire notebook using CloudDeploy[EvaluationNotebook[]], everything is automatically set to default values.

  2. Using ALT-7 I can create a text cell with mathematical typesetting easily embedded with proper centering, spacing, etc by just visually placing things where I want them in the notebook. In an attempt to reproduce this on the web I tried:

    CloudDeploy[CellPrint[Cell[BoxData[ToBoxes[Column[{Text[Style["Find the solution to the following system of linear equations:", FontFamily -> Times, FontSize -> Large]],TraditionalForm[Style[x + 3 y == 7, FontSize -> Large, FontFamily -> Times]],TraditionalForm[Style[2 x - y == 4, FontSize -> Large, FontFamily -> Times]]},Alignment -> Center]]]]]]

  3. I would appreciate any pointers on how we might proceed to create the interactivity with each question. Wrapping all of this up into a collection of Manipulate[] functions with RadioButton controls and embedded typesetting is going to be my initial effort.

Any guidance would be much appreciated.

EDIT

I've got something that is starting to look reasonable. The code is a column with two elements. The first element is a column itself with the question and equations center aligned. Element two is the multiple choice RadioButtonBar. The typesetting choices I have made are completely lost when it is deployed.

I'm actually picking the option to use FontFamily->Times. I think this should not be lost with CloudDeploy.

opt = Sequence[FontSize -> Large, FontFamily -> Times];

CloudDeploy[Column[{Column[
    {Text[
      Style["Find the solution to the following system of linear \
equations:", opt]],
     Spacer[10],
     TraditionalForm[Style[x + 3 y == 7, opt]],
     TraditionalForm[Style[2 x - y == 4, opt]],
     Spacer[10]},
    Alignment -> Center],
   RadioButtonBar[
    z, {1 -> 
      TraditionalForm[
       Style[Row[{x == 19/7, Spacer[15], y == 10/7}], opt]], 
     2 -> TraditionalForm[
       Style[Row[{x == 20/7, Spacer[15], y == 11/7}], opt]], 
     3 -> TraditionalForm[
       Style[Row[{x == 0, Spacer[27], y == 7/3}], opt]], 
     4 -> TraditionalForm[
       Style[Row[{x == 2, Spacer[27], y == 0}], opt]]}, 
    Appearance -> "Vertical", ImageMargins -> 10, 
    BaselinePosition -> Center]}], Permissions -> "Public"]
$\endgroup$
  • $\begingroup$ What kinds of things are you setting in the stylesheet? I'm not sure how sophisticated Cloud styling is just yet... On the other hand if you're deploying it via a FormFunction or FormPage (these actually can work quite well for this kind of thing) you have more fine tuned control as you can embed custom CSS to work with. $\endgroup$ – b3m2a1 May 20 at 22:55
  • $\begingroup$ Basically setting font family, size, colors and backdrops for different cell styles. Nothing really low level. $\endgroup$ – JEM May 20 at 23:36
  • $\begingroup$ Ill look into how to embed CSS. thanks for that tip. $\endgroup$ – JEM May 20 at 23:36
0
$\begingroup$

I'm having trouble reproducing your issues, actually. This kind of thing works fine for me:

CloudDeploy[
 Notebook[
  {
   Cell[
    BoxData[
     ToBoxes[
      Column[
       {
        Text[
         Style[
          "Find the solution to the following system of linear equations:",
          FontFamily -> Times,
          FontSize -> Large
         ]
        ],
        TraditionalForm[
         Style[
          x + 3*y == 7,
          FontSize -> Large,
          FontFamily -> Times
         ]
        ],
        TraditionalForm[
         Style[2*x - y == 4,
          FontSize -> Large,
          FontFamily -> Times
         ]
        ]
       },
       Alignment -> Center
      ]
     ]
    ]
   ],
   Cell[
    "meeerererg",
    "Text",
    FontFamily -> "Arial"
   ],
   Cell[
    "meeerererg",
    "Text",
    FontFamily -> "Helvetica"
   ],
   Cell[
    "meeerererg",
    "Text"
   ],
   Cell[
    BoxData[
     ToBoxes[
      Column[
       {
        Text[
         Style[
          "Find the solution to the following system of linear equations:",
          FontFamily -> Times,
          FontSize -> Large
         ]
        ],
        TraditionalForm[
         Style[
          Equal[
           Plus[
            x,
            3 * y
           ],
           7
          ],
          FontSize -> Large,
          FontFamily -> Times
         ]
        ],
        TraditionalForm[
         Style[
          Equal[
           Plus[
            2 * x,
            -y
           ],
           4
          ],
          FontSize -> Large,
          FontFamily -> Times
         ]
        ]
       },
       Alignment -> Center
      ]
     ]
    ],
    "MyText"
   ]
  },
  StyleDefinitions -> {
   Cell[
    StyleData[
     "MyText",
     StyleDefinitions -> StyleData["Text"]
    ],
    FontColor -> Pink
   ],
   Cell[
    StyleData @ "Text",
    FontFamily -> "Helvetica",
    FontColor -> Red
   ]
  }
 ],
 "this_will_be_dead_in_60_days_because_WRI_did_us_dirty",
 Permissions -> "Public"
]

CloudObject["https://www.wolframcloud.com/objects/b3m2a1.testing/this_will_be_dead_in_60_days_because_WRI_did_us_dirty"]

Which lives here: this_will_be_dead_in_60_days_because_WRI_did_us_dirty

$\endgroup$
  • $\begingroup$ this deployment worked on my laptop just now. The problem must have been local to the machine I used earlier. I will check it out. $\endgroup$ – JEM May 21 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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