3
$\begingroup$

I'm working with a consumer math class on wages and earnings, and came across the table below.

Table

As a learning exercise, and to create future tables where I can easily modify the information, I thought I would tackle this in Mathematica.

I played a bit with the grid constructs, SpanFromLeft, SpanFromAbove, etc. but I think I need a better overview before I even begin.

empname = Item[Row[{Style["Employee Name:", Bold], "\tJolie"}]];

companyA = Item[Style["Company:", Bold]];

companyB = Item["ABC Elevator Repair"];

paybegin = Item[Row[{Style["Pay Begin Date:", Bold], "\t10/13/2010"}]];

payend = Item[Row[{Style["Pay End Date:", Bold], "\t10/19/2010"}]];

Grid[{{empname, SpanFromLeft}, {companyA, paybegin}, {companyB, 
   payend}}, Alignment -> Left, Frame -> All]

Should I treat this as three tables, and use Column to pull them together?

Could I use the Torn Image approach to get the drop shadow?

I know this is a big question, looking for any comments from others who may have tried to create something similar, or direction to simply use another tool for this kind of job!

Here is some edited code, using the shadow package and some Frame constructs, should be possible to make this look pretty close.

empname = Item[Row[{Style["Employee Name:", Bold], "\tJolie"}]];
companyA = 
  Item[Style["Company:", Bold], Frame -> {False, True, True, True}];
companyB = 
  Item["ABC Elevator Repair", Frame -> {True, True, False, True}];
paybegin = 
  Item[Row[{Style["Pay Begin Date:", Bold], "\t10/13/2010"}], 
   Frame -> True];
payend = Item[Row[{Style["Pay End Date:", Bold], "\t10/19/2010"}], 
   Frame -> True];
Grid[{{empname, SpanFromLeft}, {companyA, paybegin}, {companyB, 
   payend}}, 
 Alignment -> Left,
 Frame -> True] 
$\endgroup$
  • 2
    $\begingroup$ Best to post some of the code you have tried. $\endgroup$ – Edmund Dec 26 '16 at 23:57
4
$\begingroup$

Simon Woods wrote an awesome package for drop shadows. It's called shadow.

Let table be the table in your question, then

shadow[table, 0, 10]

Mathematica graphics

If we want the shredded paper effect in Sumit's answer, we can do

shadow[table, {"TBLR", 0.2}, 10, "outline" -> True]

Mathematica graphics

As for your other question, yes, I would make those three separate tables and pull them together using Column. I would then apply shadow to the Column.

$\endgroup$
  • $\begingroup$ This is super helpful. I can almost see my way to the finished table. How do I customize the dividers (I.E. I don't want the line under company)? $\endgroup$ – Tom De Vries Dec 27 '16 at 14:29
  • $\begingroup$ @TomDeVries You'd use Frame -> {False, True, True, True} on the Item in companyA. $\endgroup$ – C. E. Dec 27 '16 at 14:38
3
$\begingroup$

You can use Torn Image approach

g = Grid[{{empname, SpanFromLeft}, {companyA, paybegin}, {companyB, 
payend}}, Alignment -> Left, Frame -> All]
img = Image@Rasterize[g]
torn[img, {{0, 1}, {1, 0}}, "offset" -> {20, 20}, "gaussianBlur" -> 10]

enter image description here

Probably it would be a better option to create a blurred frame and use Inset for the text part.

(Related post - How can I make a 2D line plot with a drop shadow under the line?)

$\endgroup$

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.