44 TUGboat, Volume 38 (2017), No. 1

SageMathCloud for collaborative document Multiple cursors for each user If a user creates editing and scientific computing multiple cursors using command- or alt-click, all cursors are visible to other users. Hal Snyder 3 Editing documents Abstract Nothing to install Because SMC is a cloud service, The open-source platform SageMathCloud (SMC) there is no software to install locally and projects lets users collaborate in real time on scientific com- are reachable from any device with an internet puting and authoring technical documents with stan- connection. Files can be compiled online to PDF dard LAT X tools. This article offers a survey of key E without the need for local installation of LAT X features, presenting SMC as a unique, unified plat- E software. form for teachers and researchers to be productive in today’s mixed software environments and interdis- Document history and backups Every edit (at ciplinary problem spaces. 2-second resolution) is recorded and stored in- definitely in SMC’s backend database. You can 1 Introduction browse the history using the TimeTravel view, All features of SageMathCloud are available as soon which also includes a mode showing exactly what as a free login is created. The following sections offer changed between two points in time (and who a tour of major features of SMC. made those changes). Figure 3 shows a Time- Travel view comparing two versions of a file. 2 Collaboration SMC stores several hundred read-only snap- SMC collaboration features apply to both static doc- shots of the complete filesystem state, which uments and executable files. Supported file types users can easily browse. This lets them recover include LATEX, Markdown, and HTML documents, older versions of files that might not have been as well as Sage worksheets, Jupyter notebooks, and edited via the web-editor (e.g., edited with Linux terminal sessions. or via a terminal). Multiple users SMC has simultaneous real-time Preview SMC supports online preview, even for collaboration with no explicit limit on the num- documents that are 150 or more pages. It pro- ber of simultaneous users. Each user can cus- gressively refines the resolution of the preview tomize the color of their cursor. Figure 1 shows images and nearby pages. One of the SMC de- an example of a second user collaborating during velopers wrote the 2016 Cambridge University an edit session. Press book Prime Numbers and the Riemann Work through network interruptions If your Hypothesis using SMC [2]. network connection temporarily fails, you can Forward and inverse search SMC supports continue editing as long as you want, and your inverse search, which means that by double- changes will be merged into the live document clicking on an area on a preview page, the cursor when you reconnect. in the text editor jumps to the corresponding Text and video chat SMC has text chat on location. Similarly, you can jump from a point the side of each document. Unlike most other in the text editor to the corresponding point in chat systems, you can include inline and display the preview via forward search. MathJax-compatible LATEX formulas and mark- Editor user interface SMC has a full-featured text down in the side chat. Users may edit any past editor for LATEX documents. It has horizontal chat message. Other collaborators are notified of and vertical split view, which lets you look at two messages via a bell in the upper right. Figure 2 points in the document simultaneously. SMC shows chat with LATEX beside file views. developers wrote a mode (github. Video chat is available as well by clicking a com/codemirror/CodeMirror/pull/4498), so button in the side chat panel. one can easily toggle display of sections, sub- Course management SMC has an integrated sections, etc. Emacs, Vim, and Sublime key- course management system, which makes it easy bindings are supported along with many color to fully use LATEX with students in the schemes. of teaching courses and workshops. For example, Customizable LATEX build system SMC fully you can create a document template with ques- supports processing very complicated LATEX tions, push it to all students, let them work on documents using custom build systems, includ- it, then collect it later, grade it, and return it. ing several LATEX engines — pdflatex, latexmk,

Hal Snyder TUGboat, Volume 38 (2017), No. 1 45

Figure 1: Editing .tex file, showing cursor of second user Harald.

Figure 2: Editable chat beside file views.

Figure 3: Edit history showing difference between two versions.

SageMathCloud for collaborative document editing and scientific computing 46 TUGboat, Volume 38 (2017), No. 1

and xelatex — with most packages preinstalled. have chat and TimeTravel and support LATEX Users can easily request additional packages (by mixed with code. Sage worksheets allow users clicking the help button), or install them them- to easily mix different languages and document selves in their local projects. The LATEX build formats in different cells of a single worksheet. command is fully customizable, and can involve Terminal sessions Any number of text-based ter- running arbitrary command sequences, since we minals may be opened to the underlying Ubuntu offer a full Linux environment. It is, for example, operating system, providing access to standard even possible to use GNU make to orchestrate Linux tools and command-line interfaces to pro- the full compilation via a Makefile. gramming languages. Dynamic content Our LATEX editing environment comes with SageTeX, which makes it easy to 5 Free and paid accounts add the output of Python (and SageMath!) com- Free accounts provide unlimited projects and collab- putations to any LATEX document. Note that orators, with 3GB of disk space per project. SMC the plots shown in Figure 2 are dynamically gen- charges for upgrades, including more disk space, CPU erated using SageTeX commands. The figure power, and outside network access, which makes it displays an excerpt from the example file for the possible to connect to the Internet from within a sagetex package by Dan Drake [1]. project in order to push and pull data to remote sites Besides SageTeX, SMC supports embedding (e.g., GitHub). For more about pricing, see https: R code via knitr into LATEX documents. This //cloud.sagemath.com/policies/pricing.html technique is popular for generating documents with statistical and data science content. 6 Further study Spell checking In addition to normal spell check- The best way to learn more about SMC is to create a ing, SMC has TEX-aware spell checking. free account at https://cloud.sagemath.com and Other document formats Side-by-side edit- try it out for editing and programming. ing also supports HTML, Markdown, R Mark- There is a wealth of tutorial and reference infor- down, and Sweave formats, all of which support mation at the SMC wiki at https://github.com/ . real-time preview and inline and display LATEX. sagemathinc/smc/wiki Figure 4 shows SMC compiling R Markdown. Articles about new features and system inter- nals can be found at the SMC blog, http://blog. The keyboard shortcut ctrl-space sagemath.com. Some of the information in this arti- common LATEX commands. cle appeared in the SMC blog posting [3]. 4 Scientific computing Source code is on GitHub at https://github. com/sagemathinc/smc. 4.1 Available software Languages SMC includes dozens of programming References languages and thousands of libraries and pack- [1] Dan Drake. dandrake/sagetex: embed ages, including computer algebra systems for code, results of computations, and plots theoretical mathematics, scientific packages for from the Sage mathematics software suite physical sciences and bioinformatics, and statis- (http://sagemath.org) into LAT X documents. tical and machine learning software for data sci- E https://github.com/dandrake/sagetex, ence. Here are some of the supported languages: 2017. [Online; accessed 2017-02-15]. Python, Sage, R, Julia, C, C++, Haskell, Scala. Packages and environments Popular packages [2] Barry Mazur and William Stein. and libraries are provided for each programming Prime Numbers and the Riemann Hypothesis. language. For Python, the entire Anaconda Cambridge University Press, 2016. suite is available. Sage alone includes symbolic [3] Hal Snyder. SMC for Collaborative LATEX and numeric packages, including NumPy, SciPy, Editing. http://blog.sagemath.com/latex/ matplotlib, Sympy, Maxima, Pari/GP, GAP, R, 2017/02/06/smc-for-latex.html, 2017. and Singular. See Figure 5. [Online; accessed 2017-02-14].

4.2 Programming frameworks  Hal Snyder Interactive notebooks In the category of interac- Sagemath, Inc. tive notebook computing, SMC offers Sage work- hsnyder (at) sagemath.com sheets and Jupyter notebooks, both of which https://cloud.sagemath.com/

Hal Snyder TUGboat, Volume 38 (2017), No. 1 47

Figure 4: Compiling an R Markdown file in SMC.

Figure 5: Sage worksheet with LATEX in markdown, symbolic expressions, and units of measure.

SageMathCloud for collaborative document editing and scientific computing