This package highlights:
`: ... 'as well as after
regexm()functions, as well as the vastly expanded regex syntax provided in Stata 14 and 15 through the
Other nice features:
language-sqlbase package must be active.)
To install, do one of the following:
apm install language-stata
The local macro back tick autocompletion won't function until you fully restart Atom. Do
cmd-shift-P to bring up the command palette, type
Window: Reload, and click enter.
Atom allows you to toggle whether a line is commented using ctrl+/. As of version 1.6.5, the comment character this uses is
// by default. You can change this to use
/* */ or
* characters to comment lines.
To change to
/* */ comments, you can put the following in your
'.source.stata':editor:commentStart: '/* 'commentEnd: ' */'
To change to
* comments, use the following. However I don't recommend using this character1.
'.source.stata':editor:commentStart: '* '
Note that in your
config.cson file there can only be a single
'.source.stata' top-level key, and only a single
editor key under
'.source.stata'. If you customize some other settings within the Stata grammar, you might already have a
'.source.stata' key, and thus you would add the
commentStart key to it.
There are three ways to run code in Stata from Atom
#delimit ;interactively with your code
You'll need to have both Hydrogen and
stata_kernel installed. You can
install Hydrogen from the Atom settings pane; see the
documentation for more
information on how to install
stata-exec package sends selected Stata code to an open Stata GUI window on Windows, macOS, and Linux. This differs from Hydrogen because it allows you to still interact with the Stata GUI. This might be easier for users who are new to Stata. However, it can be difficult to successfully install this on Windows.
The script package will run code in the Stata console, but has the limitations 1) each command is run in a separate session of Stata, 2) it currently doesn't work with selections; you have to run the entire file, 3) it doesn't work on Windows.
Stata 15 brought new features for working with dynamic documents. The
dyndoc command lets you write in Markdown and converts your file and code to HTML for viewing in a web browser.
It also added the
dyntext command, which fills in Stata output for any text file, without touching the text itself. This lets you then use third-party document generators like Pandoc and LaTeX to generate documents.
This package provides syntax highlighting for Stata code written inside Stata's dynamic tags for Markdown and LaTeX documents.
By default, this package's Markdown and LaTeX syntax highlighting will be applied for files ending in
.dotex respectively. The language-markdown and language-latex packages must be installed for the highlighting to work.
If you name your file with a different extension, you can manually set the highlighting by clicking on the "Plain Text" button on the bottom right of the screen (or by pressing CTRL+SHIFT+L). Then type
stata and you'll see a list of choices:
.do file, choose
source.stata; for a Markdown dynamic document choose
source.dyndoc.md.stata; and for a LaTeX dynamic document choose
Both Hydrogen and
stata-exec should work for running code interactively, even within a dynamic document.
An example of the PDF output of using
dyntext and Pandoc is in the examples folder:
That file was created by running
dyntext dyntext.domd, saving(dyntext.md) replace
from inside Stata 15, and then with
pandoc dyntext.md -o dyntext.pdf
on the command line using Pandoc.
dyntext.dotex is a proof-of-concept and should compile with LaTeX but the output is not shown here.
If you use the user-created command
webdoc, you can
add highlighting by using a
.dowd file extension or by manually selecting the
language of the current file to be "Stata Webdoc".
1: The following code is legal Stata code, but Atom will confuse the
* used as multiplication with the
* used for a comment. So if your cursor is on the second line and you press ctrl+/, Atom will remove the
* symbol and the semantic meaning of the multiplication will be lost. Thus using
// as the comment symbol is safer.
display 2 ///* 2
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.