stata package and
sjlatex are not developed by stata, and are thus not subject to being explained over there, I will provide a tutorial to link the two here. I hope this works out for you, otherwise you can always pay a visit to the link below and you might detect an error in the tutorial or just notice what you did wrong during following this tutorial. Any comments appreciated. If the tutorial becomes outdated, please let me know or feel free to update it. I do not own a recent license of Stata any more, so I probably won't be able to update it myself, I guess.
Linking Stata 14 and MikTeX on Windows
ssc install texdoc, replace
net from http://www.stata-journal.com/production
net install sjlatex
in file explorer
- go to Stata root working directory (e.g.
C:\Stata or the one you chose during Stata installation)
- there you will find the
.cls files pertinent to LaTeX, which you can install to a localtexmf tree
- if you don't remember what that was, open Stata and type
pwd --> your standard directory will be displayed
- open new instance of file explorer
- go to
enter the following commands, which will create directories to mimic the TDS (Original publication, Wikipedia article about it containing further links
sj.version into new directories in accordance with TDS
- open "MikTeX Console" (Admin, in case you installed as root)
- go to "Settings" > "Directories"
- click "+" and add
- open "Tasks" and click "Refresh FNDB" and optionally also "Refresh font map files", if you installed the Stata fonts
- exit MikTeX console
TeX editor or cmd or PowerShell
- test installation with
main.tex provided with
main.tex doesn't work, something is wrong. Don't try with your own file as long as
main.tex doesn't work. This file is proved to work. It's like the hello world of stata and TeX.
finally (and very importantly)
check the website http://repec.sowi.unibe.ch/stata/texdoc/index.html for any updates to texdoc
If you are not trying to publish for the Stata journal, but just want to use LaTeX to include Stata code and examples in your duckuments, it is recommended to use texdoc instead of sjlatex, sj.cls, and sj.bib. You should check out the introductory tutorial by the texdo developer found at https://www.stata.com/meeting/switzerland16/slides/jann-switzerland16.pdf for help to get started with texdoc.
I don't compile stata-texdoc file on my Linux machine, but the process is very similar, except that you can't install stata on Linux and thus don't need to install texdoc in Stata for Linux (which doesn't exist). I don't compile stata-texdoc file on my Linux machine, so, I won't provide a tutorial for it. It would be hit or miss. You're welcome to add your Linux tutorial here or as a separate answer.
How can I manually install a package on MiKTeX (Windows)
Purpose of local texmf trees