Programmatic Lecture Slides Made Even More Difficult with R Markdown

In Easy Lecture Slides Made Difficult, I showed how to use markdown to make slides while still retaining some aesthetic flexibility. All that was required was a handful of TeX Macros, a little python script, a few Makefiles, and a maniacal commitment to automation. That was an enjoyable trip into the abyss, but what if your slides regularly include the results of calculations, data visualizations, or computational examples? Then it is time to, how do they say it these days, dive deeper. Thanks to R Markdown and knitr, it is possible to build on the pandoc/beamer system I described before to incorporate program code and its results. Call it, uh, Presentationally Literate Programming.

I am spurred to describe my approach by two things: first, I have had a whole semester of teaching Literary Data to work out the kinks; in that graduate course I regularly used R markdown-based slides to present new material. (Here are a couple examples: slides on network visualization, April 23, 2015; slides on topic modeling and PCA for literary texts, April 16, 2015.) Second, I was just at a conference where almost everyone’s presentation had slides with R output in them, but it seemed like people might…benefit…from an example showing how to make the aesthetics of the R output and the slides more consistent with one another. I’ll also show how the same R markdown can be the basis of slides, speaker notes, and a handout for audience members to take notes on. And I’ll show the settings for incorporating program code into the slides, which I used in my teaching. At the end of this post, I imagine you will question my sanity. The whole setup can be found in this repository subdirectory on github.

[Update, November 2015. I’ve made a slightly easier-to-use version of the same setup available as an R package here.]

read more…

At Temple This Week

I’m giving a talk at the Center for the Humanities at Temple tomorrow, Wednesday, April 8, in their Digital Humanities in Practice Series.

Quiet Transformations of Literary Study, 1889–2013

The history of literary scholarship is usually presented as a succession of conflicting ideas. Yet gradual, distributed change is equally significant, and often less visible to practitioners, who remember recent dramas better than the unspoken norms of eighty years ago. Understanding such change requires new methodologies. I present an analysis using probabilistic topic modeling to reveal broad trends in more than 21,000 literary-studies journal articles. As literary and cultural studies confronts the interpretive challenges posed by topic modeling and other quantitative methods, we increasingly enter the methodological domain of the social sciences.

It’s at 4:00 p.m. in the CHAT Lounge (details on the CHAT website). I can promise at least 300 words on tokenization1 and the phrase “post-Marxist Mechanical Turk” used as sincere praise.


  1. Or 294, depending on how you count. ↩︎

Easy Lecture Slides Made Difficult with Pandoc and Beamer

Markdown for slides is a great idea. Don’t painfully lay out each slide, click by click: just write down an outline and let a program generate the slides for you. The almighty Pandoc does this very well. You write plain text, and a single pandoc command produces slides in one of a number of nice HTML formats (like reveal.js or slidy), ready to be uploaded, or in PDF.

I switched over to this way of doing things last year. It was a relief to stop fighting with Keynote,1 which is nice as presentation programs go but still exhausting: it constantly makes wrong guesses about formatting; putting text where you want is a struggle, and inevitably imprecise. And, worst of all, adding notes for myself to slides is pretty hopeless. I always ended up having to create two parallel versions of each class: the slides, and my own notes. That involved a lot of redundant work. By contrast, once I started writing my slides and notes together, I got my materials for class together quite a bit faster. Whether the temptation to further procrastination/tinkering was really healthy is a separate issue.

Anyway, markdown for slides with pandoc is pretty simple and easy-to-use, but because I wanted some features that the HTML formats do not easily support, I was tempted into going with pandoc’s capacity to generate LaTeX slides using the beamer package. Getting what I want out of that setup is what makes easy slides difficult. (If you want easy slides made easy, consider Ben Schmidt’s suggestions.) Here’s what I do these days. All the bits and pieces for doing this can be found in my repository of TeX stuff on github, in the lecture-slides directory. [Edit, May 18, 2016: I now use a slightly tidier set-up, available in a new repository.] For a sample of the kind of results I get, see the slides from my Early Twentieth-Century Fiction course this semester, for example a lecture on Djuna Barnes.

read more…

Signs@40 Celebration and Panel Discussion

This week I’m participating in an event at Rutgers celebrating the launch of Signs@40: Feminist Scholarship through Four Decades, which I co-edited. We’ll hear from past, current, and future editors of Signs, the team that created the retrospective, and members of the Signs editorial board.

Signs@40: 1975–2014

Thursday, November 20, 3:00–5:00 p.m.
Mabel Smith Douglass Room, Douglass Library
Rutgers University
8 Chapel Dr.
New Brunswick, NJ 08901 (Google Maps)

Reception to follow.

Signs@40

For the past year I have been working with the journal Signs on their fortieth anniversary project. Signs@40: Feminist Scholarship through Four Decades is now live. It features an interactive visualization of a topic model of the journal’s archive that I created in collaboration with Andy Mazzaschi, Susana Galán, Laura Lovin, and Lindsey Whitmore. The model is accompanied by commentary—both our own guide to exploration and commentaries by Signs editors and contributors past and future. The Signs group also created a series of thematic tables of contents for the journal and adapted a co-citation network visualization originally developed by Jonathan Goodwin. The whole provides many pathways for exploring the work of this central institution of feminist scholarship.

We will shortly make the source code available on github, where I’ll also add a few more technical notes on our modeling process and our visualization design. Here are some early thoughts about the site itself, now that it is at last whole and public:

read more…

At Penn This Week

This Thursday, I’ll be visiting Penn’s Digital Humanities Forum to discuss topic modeling and the sociology of literature. It’s a “Tools and Techniques” session, which means an informal discussion focused on method. I wonder if I will get in trouble for carrying my personal MALLET on Amtrak. Description:

This workshop introduces probabilistic topic modeling for humanists, focusing on applications in literary studies. Using my own work on the history of literary study as an example, I’ll give an informal introduction to the algorithm, survey the nuts-and-bolts technical choices involved in modeling, and discuss the challenges of interpreting the algorithm’s output. Strange and novel as this technique may seem, I’ll argue that it may be surprisingly well-suited to investigating some of literary studies’ central questions about the relation between literary history and social phenomena—and to rediscovering the methodological concerns the humanities share with the social sciences.

If you’re in Philly, it’s at noon in Penn Library, Seminar 627. Register by e-mailing saravarney@sas.upenn.edu.

Update, 10/16/14: slides

At Carnegie Mellon This Week

Event poster created by Christopher Wike

Event poster created by Christopher Wike

I’m giving a talk at the Literary and Cultural Studies Colloquium at Carnegie Mellon this Thursday, October 2:

Is it our job to be the best readers?

The emergence of quantitative methods for literary study allows us reassess the relationship between literary scholarship and the practice of expert critical reading. Though reading has the status of doxa in literary studies, it may obscure more than it clarifies about the problems posed by quantification. I exemplify the challenges in a quantitative analysis of scholarship itself, using a probabilistic topic model to explore discursive patterns in twenty-one thousand journal articles from the 1880s to the present. The model reveals, among other things, the surprisingly recent emergence of the theme of reading and the scope of literary studies’ turn toward the terrain of the social sciences since the 1970s. It is, in fact, the social sciences that might help us toward methodological alternatives to “reading” that allow us to make sense of the aggregate patterns in literary practice revealed by techniques like topic modeling.

If you’re in Pittsburgh: it’s at 4:30 p.m. in 255B Baker Hall.

Spring 2015 Courses

I’ve updated the Teaching page with descriptions for my Spring 2015 courses. I’m always glad to hear from interested students at my Rutgers e-mail.

In the undergraduate program, I’m teaching Principles of Literary Study: Prose, one of the English major requirements. There’s nothing quite like having the chance to be the pied piper introduce the great intellectual pleasures of my subject. (This was formerly “Principles of Literary Study: Fiction,” and I really teach the course as a principled introduction to fictional narrative. A course goal: students will be able to explain the distinction between prose, fiction, and arrative.) This syllabus is forthcoming.

My graduate course is new, and very experimental: Literary Data: Some Approaches. It’s about quantification and data in literary studies, an issue current discussed in and around “DH” but really part of the long dance of literary studies with the other human sciences. We’re going to learn enough programming (in R) to start in on analyzing data. I hold no particular brief for “coding” or “making,” but I think this is the best route into the quantitative at the moment, as well as an important way to concretize the theoretical and methodological debate about literary data.

Fun with Dates

The website for Ted Underwood’s and my Quiet Transformations of Literary Studies has just been updated. Though this doesn’t add much in the way of new functionality (just a slightly modified bibliography display), every single chronological datum on the site has been changed to correct an error. Importantly, this means:

  1. Every time-series chart is slightly different (more explanation below).
  2. These charts now match the visualizations in our preprint article, which were not subject to this error.
  3. Article bibliographic information more closely matches JSTOR’s.

In not entirely unrelated news, I learned more about date encoding in Javascript and d3.js. After the jump, an explanation of the bug.

read more…