This is a collection of useful tips and features for TeXstudio.
We encourage users to contribute and write down, what they deem interesting for others to know.
The editor TeXWorks introduced special LaTeX comments in the format % !TeX [command]
, which allow to pass information to the editor.
A subset of these commands is supported in TeXstudio. Currently these are:
% !TeX encoding = UTF-8
Tells TeXstudio which encoding to use for loading the file (Note: There is an automatic encoding detection in TeXstudio, which will work in many cases, but is not perfect. This command is only necessary, if automatic encoding detection fails for your files)
% !TeX spellcheck = en_GB
TeXstudio will automatically load the specified dictionary for spell checking. This allows to easily work with files in different languages without the need to manually switch the spellchecker for every document.
The Insert Graphic wizard allows to conveniently insert images in your document by automatically generating all necessary code. You can also start the wizard by dragging % dropping images to TeXstudio. This works also for multiple files. Furthermore the wizard allows to edit existing graphics inclusion code. Just place the cursor on the code and start the wizard.
The fullscreen mode can also be started by double-clicking on an empty area on the menubar. This is in analogy to double-click on the window title bar, which maximizes the window in most window managers. Currently, this feature is working only for the main window. (In Ubuntu Unity, Alt-f, the letter not a function key, restores the menu bar allowing an exit from fullscreen mode).
A cursor for simultaneous editing of multiple rows can be created by holding <Ctrl> and dragging the mouse vertically. You can also select blocks with <Ctrl>+<Shift> or create multiple cursor at arbitrary positions by holding <Ctrl>+<Alt> and clicking (not dragging) somewhere .
We are continuing to make TeXstudio more context aware. Look out for tooltips and context menus that give additional information and useful functionality in various places.
When configuring the toolbars at Options -> Configure -> Toolbars you can add complete submenus to the toolbar (e.g. the Tools -> Commands menu). Such a menu will appear as a dropdown list in the toolbar.
TXS does not natively support multibib. However, you can make it work with the following settings.
pub
you create using the \newcites{pub}{Bibliography Title}
command add the following four lines to the .cwl file:\citepub{%<bibid%>}#c \nocitepub{%<bibid%>}#c \bibliographypub{%<file%>}#b \bibliographystylepub{%<style%>}
replacing pub
for the actual used name. Go to TeXstudio Config -> Completion and check your created cwl file there.
bibtex ?*.aux
multibib.bat
with the following content@ECHO off IF (%1)==() GOTO end FOR %%f in (%1\*.aux) DO bibtex %%f @ECHO on :end
multibib.bat
to a reasonable place (e.g. the bin directory of your tex installation). This may be C:\Program Files\MiKTeX 2.9\miktex\bin or C:\texlive\2012\bin\win32. But any other place will also do.multibib.bat
.TXS automatically recognizes references and citations. This does not work out of the box if you define your own commands \newcommand{\myref}[1]{(see \ref{#1})}
or \newcommand{\mycite}[1]{(see \cite{#1})}
.
The following steps describe how you can announce your own commands to TXS.
usercommands.cwl
. And add lines similar to\mycite{%<bibid%>}#c \myref{%<label%>}#r
the c
after #
marks the command as a citation, likewise r
marks it as reference.
For more information on .cwl files see the corresponding section in the user manual.
The auxiliary files created by LaTeX clutter there working directory. Aside from using Tools -> Clean Auxiliary Files
for cleanup, you may want to have these files in a separate directory. This can be achieved in the following way:
-aux-directory=DIR
: For this you modify the pdflatex command at Options -> Configure -> Commands
, e.g. by adding -aux-directory=aux-files
../aux-files
at Options -> Configure -> Build -> Build Options -> Additional Search Paths -> Log
(Advanced Options have to be enabled to configure this).bibtex.exe -include-directory=aux-files aux-files
biber.exe % --output_directory=aux-files
Note: You have to create the directory aux-files
yourself because pdflatex apparently exits with an error if the directory does not exist.
In collaboration with the guys from JabRef, we implemented the possibility to directly insert citations from JabRef into TeXstudio (Included in JabRef >= 2.9. Use the plugin PushToTeXstudio-1.0.jar for older versions).
Only necessary for JabRef < 2.9:
For all:
Optional: The settings can be reached by right-clicking on the TeXstudio icon in the drop down list:
\cite
by \autocite
). For OSX you have to set the full path here. In a standard installation this is /Applications/texstudio.app/Contents/MacOS/texstudio
.If using biblatex: Back to JabRef main interface, go to Options → Preferences and:
Usage:
\cite
(or \autocite
) command is inserted in TeXstudio and its mandatory argument contains the (list of) key(s) of the reference(s) you have selected.TeXstudio only supports one dictionary per file for spellchecking. This is a limitation for documents with multiple languages, because all except the selected language are marked as errors. As a workaround, one can create a hybrid multi-language dictionary with HunspellMerge and use this one for spellchecking.
An alternative, is to just switch between multiple dictionaries, using the dictionary switch button in the statusbar.
Make your .sty
file known to the LaTeX distribution you are using. This step ensures that (pdf)latex knows your file an can use it when compiling. It is not TeXstudio specific and you can find detailed descriptions on the web (e.g. for MikTeX or for TeXlive. For TeXlive, you should texhash
, because TXS uses the ls-R
cache (see 2.). From now on compilation works fine. The issue is just that TXS may highlight the package name or commands as unknown.
Package Names: TXS tries to obtain the information on installed packages from the distribution.
With TeXlive, your package will be detected (make sure you have texhash
ed). For MikTeX, there's currenly no solution to detect packages in a local texmf directory, so you'll have to live with underlining missing package marker here. For details see Why does TXS mark a package as missing?.
Commands: Read How does TXS know about valid commands. While TXS has some limited capability of auto-creating cwl files from sty files, we recommend to explcity write a cwl file and place it in according folder. When TXS finds an \usepackage{mypkg}
command, it loads the corresponding mypkg.cwl
and the commands defined therein will become known.
When using the portable version on a USB drive, paths (e.g. to a portable MikTeX installation on the same drive) may change because the USB drive might receive different drive letters on different computers.
To set up an always woking configuration, you can use paths relative to the texstudio executable [txs-app-dir]
and the settings directory [txs-settings-dir]
. For example you could use
[txs-app-dir]\..\MikTeX Portable\miktex\bin\x64\latex.exe