This guide explains how to work with the frame editor for editing source code, LaTeX documents, Command-line terminal etc. The screenshot below shows a Python file and a Terminal. In order to get that view, the frame editor is split vertically first, and then the right frame is split horizontally. After that, the bottom right frame is changed to a Terminal.
You can not only view the same Python source code in two places, but you can also work with e.g. IPython on the command-line in the same directory.
Supported file types
If you open/create a file ending with
*.md, you’re presented by default with a split view of Markdown code on the left and HTML rendered output on the right hand side.
There’s an entire page in this guide dedicated to Markdown.
Text, Source Code, and Data Files
The frame editor lets you edit many types of text files. Here are some of the most common types, followed by the filename extension:
C source code:
C++ source code:
Java source code:
*.html file and you’ll see the rendered output on the right hand side. You can switch the rendered view between “Preview” (which is faster) or “iframe” (which renderes the page as it is) depending on your needs. You can even close the editor pane, to just see the rendered HTML.
*.rmd file to work with R Markdown.
Depending on the configuration in the preamble, you either produce an HTML or PDF output.
Do not forget to switch the panel for the rendered output accordingly. Here is an example of R markdown producing a pdf file:
If you produce PDF and HTML output, you can see both after splitting the panel.
There is a brief tutorial on R Markdown in the Project Library. To view the sample files, do the following:
Open a project where you want the copied files to be placed.
Open the Files tab.
Click “Library” at upper right.
Select “RMarkdown in CoCalc”.
Click “Get a copy”.
See LaTeX Editor.
You can get multiple cursors while editing any file in the frame editor using the mouse and ctrl+click (cmd+click on Mac).
If you switch to Sublime keybindings in “Account” > “Preferences” > “Editor settings”, you can select text and then use ctrl-D (cmd-D on Mac) to multi-select the next occurrence of the same text.
The frame editor also supports simultaneous editing by more than one user. In this case, separate cursors are displayed for each user.
Here are two ways to spell-check your documents in CoCalc.
Use your browser’s native spell checker.
The CoCalc frame editor supports the browser’s native spell checker for varying file types, including
.html. See the documentation for your specific browser for information on how to enable and configure spell checking. You may have to save your file before the spell checker is activated.
Use the ``aspell`` Linux command.
aspell utility will find possible misspellings and offer corrections. Here’s how to use it:
Open a Linux Terminal
aspell -t -c <filename.tex>
You can add words for
aspell to ignore using personal dictionaries. These words won’t be underlined red. To do this create the file
lang is the choice of langauge. The first line of this file should be
personal_ws-1.1 lang 0, where
lang is the choice of language. Then add one word per line for
aspell to ignore. For example, to ignore the words ‘bijection’ and ‘surjection’ in an English document, create the file
~/.aspell.en.pws with the content:
personal_ws-1.1 en 0 bijection surjection
The changes will take place the next time
aspell is run on the document.
You can share comments on a CoCalc file using a side chat panel. For more information, see Side Chat.
Search and Replace Inside the File
You can search for a string of text in your file while editing by hitting Ctrl-F (or Cmd-F on a Mac) and entering the string you want to search for in the blank that appears at the top. If you want to search for a regular expression rather than simple text, surround the regular expression with slashes. For example, to search for a pound sign and a space at the start of a line, enter
/^# / for the search string.
Other commands relating to search and replace:
Ctrl-F / Cmd-F: Start searching
Ctrl-G / Cmd-G: Find next
Shift-Ctrl-G / Shift-Cmd-G: Find previous
Shift-Ctrl-F / Cmd-Option-F: Replace
Shift-Ctrl-R / Shift-Cmd-Option-F: Replace all
Alt-F: Persistent search (dialog doesn’t autoclose, enter to find next, Shift-Enter to find previous)
Implementation note: CoCalc’s frame editor search is implemented using the CodeMirror search function.