I use VSCode to write LaTeX using the LaTeX-Workshop VSCode extension, MiKTeX, and pdflatex. The LaTeX-Workshop extension comes with the handy feature of being able to hover packages and view their documentation, but I noticed that this feature does not work on the tikz package.
Screenshot with more detail.
I started looking into why this was the case, as the ctan page linked had this long and very detailed manual for TikZ and PGF. It turns out that MiKTeX does not even list a package called TikZ, which is confusing as my .tex files seem to compile fine when including the line \usepackage{tikz}, whereas attempting to use any other 'nonexistent' package would result in a compilation error.
I've gone through half a dozen webpages trying to understand what PGF and TikZ are in more detail, but it is very confusing. The ctan PGF page says "PGF is a macro package for creating graphics... that comes with a user-friendly syntax layer called TikZ", but I'm a little confused about what that means. Why would the package and syntax have different names?
My questions can be summed up as:
What exactly is PGF and TikZ? What's the difference between the two and is there a reason why they have different names?
How does my LaTeX compiler interpret "\usepackage{tikz}" if I don't have a package by that name installed?
What are TikZ libraries and what do lines like "\usetikzlibrary{arrows}" do exactly? Are they basically the same as packages?
If I'm using MiKTeX, where are the TikZ Libraries stored on my machine (Windows 10)? I have been able to find most other packages and their documentation within subfolders of "C:\Users\{USERNAME}\AppData\Local\Programs\MiKTeX 2.9\".
Instructions on how to link the TikZ/PGF manual pdf to MiKTeX so I can easily access the documentation in VSCode would be nice, but that is not really the focus of this post.
For clarification, I am not looking for a tutorial on how to use PGF/TikZ (there are many other good resources for that), nor am I looking for an overly high-level answer like "PGF/TikZ is a LaTeX package for creating graphics" that don't provide any more detail, I know that much already.
Pre-remark:
There are two slightly different usages for the word "package" in the latex world, one is the traditional \usepackage{....} you know from your latex document, the other is the ctan/miktex/texlive package. Most of the time, a ctan/miktex/texlive package simply contains the latex package of the same name, but sometimes it can have a different name and/or contain multiple latex packages at once.
What exactly is PGF and TikZ? What's the difference between the two and is there a reason why they have different names?
pgf provides the low level commands, like strokes etc. and tikz builds on top of this and uses the low level pgf commands to draw more complicate things, like geometrical shapes or rubber ducks (shameless plug)
This division between the low level and high level code is very useful, because it allows the user to load just as much as necessary. Take for example the beamer class. It uses all kinds of low level pgf commands to draw decorations on the slides, so it loads (parts of) the pgf package. It does not need all the fancy stuff from the tikz package, so it does not load it, which safes tons of time, because loading all of tikz is relativity slow.
How does my LaTeX compiler interpret "\usepackage{tikz}" if I don't have a package by that name installed?
You do have it installed, it is contained in the ctan/miktex/texlive pgf package. \usepackage{tikz} basically translates to \input{tikz.sty}. This file in return will load the latex pgf package (and many other things)
What are TikZ libraries and what do lines like "\usetikzlibrary{arrows}" do exactly? Are they basically the same as packages?
yes, they are basically packages for tikz with which you can extend the capabilities of tikz even further.
If I'm using MiKTeX, where are the TikZ Libraries stored on my machine (Windows 10)? I have been able to find most other packages and their documentation within subfolders of "C:\Users\{USERNAME}\AppData\Local\Programs\MiKTeX 2.9\".
You can look this up yourself in your .log file. Search it for tikz.sty and this and the following lines will tell you the location of all the files.
Instructions on how to link the TikZ/PGF manual pdf to MiKTeX so I can easily access the documentation in VSCode would be nice, but that is not really the focus of this post.
If you open a new terminal in vscode (ctrl+shift+`), you can open the user guide by typing texdoc tikz or texdoc pgf (same file, just multiple ways to open it)
I've used Sphinx to document a Python library. So far this works great, I get nice HTML and LaTeX output. Concerning Latex, Sphinx generates a complete standalone document with lots of special packages and configurations.
But, I would like to integrate the generated Latex files within an already existing Latex project (more precise: in the appendix of a book). In particular I want the Sphinx-generated documentation pages to have the header, footer and section heading styles of the parent document. I guess I could somehow transfer the relevant parts by manually removing unneeded stuff and adjusting various options in the tex files generated by Sphinx. However, probably this is going to be a very tedious fiddling taking too much of my time (thinking of conflicting packages and options I have to detect and fix).
Does Sphinx' Latex-Builder support such a use case? If not, is there a more general approach how to merge independent Latex-documents?
Thanks for any hints!
It seems there is no generally valid answer to this question. I've asked this question on the sphinx mailing list and received an answer which basically says one has to manually extract and partly convert the relevant parts of the latex code generated by sphinx - a less expensive solution does not yet exist.
I'm writing an MSc dissertation and I'm having difficulty getting the longnamesfirst option working in natbib.
My University has a very specific referencing style a little like APA, but not quite the same. I've used the docstrip utility to build a basic framework and then edited it to fit the requirements of my University.
Having tested it with the simplest possible document; applying my bst then trying it again with one of the defaults (\bibliographystyle{apacite}) I can see than natbib works as intended with apacite. It doesn't however produce correct results with my bst.
So my question:
How does the .bst file link with natbib to enforce the "longnamesfirst" option?
I've come to a solution. Looks like my bst file wasn't correctly written to take advantage of natbib's longnamesfirst option. In particular, there are a few functions like format.full.names I didn't have. It appears natbib needs these to generate those crucial first few references.
A regeneration from latex makebst and a merge later and I'm good to go.
Scenario: I have a main Latex file (main.tex) in which I include a subfile (appendix.tex) using the subfiles package.
Role of appendix.tex: It further includes all the appendices as subfiles kept in an appendix subfolder, so that I just need to include the appendix.tex in the main.tex file.
Current Situation: I have to manually list the appendices in appendix.tex which can be cumbersome to manage.
Target: I want to create a foreach loop kind of thing in the appendix.tex file such that it looks in the appendix subfolder and includes each of the .tex files present in it.
Question: How can this be done?
This can be relatively easy implemented with python.sty from here. This would require you to make sure that the style file and python is available on all machines were you plan to compile this document, but should be more portable than using shell scripts or preprocessors like cpp.
Probably easiest done externally via a shell script. Provide some more info on your OS (Win/Apple/Linux) and someone will no doubt provide the necessary script.
I did it the other way, with a python pre-processor for LaTeX. My preprocessor generates tables and allows raw python to be put into the LaTeX file. Since python.sty requires that LaTeX be compiled with shell escapes, this may be a better way.
I can post the preprocessor if there is interest.
What solutions are there for working on a LaTeX document on both Windows and Linux?
It's a large document, and I will be working daily on both platforms so compatibility is essential if it's two different pieces of software.
Bonus points for a solution that includes easy previewing.
Writing text is not very different from writing software. Similar management techniques apply when scaling up.
Modularity: Split the document to smaller pieces e.g. a separate .tex file for each chapter. I also like to keep the preamble and other LaTeX set-up separate from the body text. My chapter files themselves just have the body text with some markup but do not define any new commands.
Source control: Keep all the source files in a version control tool such as subversion. Transfer files between systems using the tool.
Builds: Have a Makefile or similar to control the build process: it should be consistent and repeatable. Build regularly and fix build problems as soon as possible. If you want easy previews, you can set up a Makefile rule to launch e.g. a PDF viewer after the target PDF has been compiled.
Editing: Use whatever you're compatible with. It does not matter that much, though some good advice has been given by other answerers.
Communication: If there's more than one person working on the same stuff, no tool is a substitute for interpersonal communication.
TeXworks is a new cross-platform TeX editor with a built-in PDF preview that has source-output synchronisation. Click in the source to go to the matching part in the output, and vice versa. It's not the most feature-rich editor, by design, but the simplicity/power trade-off is just right, in my opinion.
I've used Emacs and its AucTeX mode, which is great for editing, as it has a set of very consistent shortcuts to insert many common commands and environments. There are also preview modes that display maths graphically in the Emacs window but I haven't used them.
As with VIM, there's a learning curve of course.
Unlike Legoolas, I'd advise for direct-to-PDF compilation using pdfTeX, but maybe Windows/Linux doesn't have a PDF viewer that automatically reloads the file? I'd be surprised if so (I use Skim on Mac). Check if your viewer supports synctex, as it's quite handy to navigate from PDF to source and back, without the cons of pdfsync.
To compile, my tool of choice is latexmk which is included in TeXlive. It completely automates the build, and can watch the .tex source to rebuild automatically.
Try LyX – The Document Processor, a "What You See Is What You Mean" editor for LaTeX.
Eclipse with its TeXlipse plugin should solve the IDE problem. More important are, however, issues like using only fonts that are available or installable on both platforms.
For previewing I am using Emacs with its Preview Latex feature in the AucTeX package.
For windows, you can use the TeXnicCenter, that is one of the best IDE for windows.
For Linux, you can use simply use Kile (it is possible to use kile with KDE on CygWin, but it is not the perfect solution).
There is no problem to switch from one IDE to another one (since you just save the .tex file and nothing else)
It also exists some cross-platform IDE, but I do not know them:
TeXmaker
TeXmakerX: a fork from TeXmaker
Since you'll probably not want to change text editor from whatever you usually use just for editing LaTeX docs (unless you use an editor which can't do syntax highlighting for LaTeX as well as whatever else you code/write in it), I'd recommend the simple following set of tools:
Whatever text editor you are used to, as long as it can highlight LaTeX markup. If it can't, then find a better editor for using with everything you do!.
Install MikTeX or TeXLive and just use the DVI viewer which comes with them by double-clicking on your DVI file. This will automatically update whenever the dvi file is changed by your editing of the latex file and re-creating the output.
I use Emacs as my text editor of choice, on both Linux and Windows. Setting up some scripts or makefiles to build the latex document when I hit a key is pretty easy, and fits in with everything else I use Emacs for nicely.
Other cross-platform options (many of which have already been mentioned by others in this thread):
LyX
TeXlispse for Eclipse
I've used VIM, combined with the VIM-LaTeX plugin, with great success. It does have a bit of a learning curve though.
Gummi is the best LaTeX editor. It is a free, open source, program written in python, featuring a live preview pane.
http://gummi.midnightcoding.org/
e4 http://gummi.midnightcoding.org/wp-content/uploads/20091012-1large(1).png
Get your work in some kind of version control system, then when you move from computer to computer you just update from a central server and its just like you left it.
It doesn't matter about the IDE, as you are saving just the .tex file, as noted above. If you want to use the same editor though, for the sake of coherency, use texmaker.
I use version control, and just use MikTex/WinEDT on Windows and TexShop on the mac.
IF your document doesn't compile on both, you're probably forgetting to keep the two directories synchronized or use funky commands, I like the sanity checks of knowing that it "compiles" cleanly on two platforms.
I use some text editor, and then I have a cron job that does a compile hourly from my source control.
Tex files are just text. I would recommend using a version control system (you should be using that anyway) to keep the source in sync. You can then use any (or different) editors on each system, e.g. Kile for linux and winEdt for windows. Both com with nice viewrs.
For a simple solution for the source control that just works with minimum knowledge and hassle, consider dropbox.
Revisiting my own question after quite a few years, I thought I'd add
https://www.writelatex.com/
not strictly what I had in mind, but have used it for collaborative writing
An excellent multiplatform LaTeX IDE is Texmaker.
For Debian or Ubuntu, I made a tutorial easy to follow: Install LaTeX on Ubuntu or Debian. This tutorial explains how to install LaTeX on Debian or Ubuntu and how to create your first PDF.