Latextools does not display cite keys if .tex file is in subfolder - latex

The wonderful LatexTools plugin for Sublime Text 2 autocompletes references when using \cite. Everything works perfectly when the .bib filed is in the same folder as the .tex file, and the .tex file includes the \bibliography command.
Unfortunately, for my larger projects, I keep my chapter .tex files in a subfolder. The \bibliography command only appears once in the master .tex file, and the .bib file lives with the master .tex file.
Is there a way to "point" LatexTools to my bibliography for all of the sub .tex files which do not include the \bibliography command, so that I can get autocomplete working?

LatexTools searches for a root file that is specified in the subfile you are editing. When it finds such a file, it will look for bibliography related commands there and load the corresponding data. You provide the root file by placing the line
%!TEX root = ../my_main_file.tex
in the (first line of the) subfile.

Related

Doxygen cannot parsing the structure documentation in the source file

Doxygen cannot parsing a structure documentation inside .c file(and cannot create a corresponding .tex file) but parsing correctly from a separate .h file
Assumptions: Does the structures inside .c file where generally the functions are documented are not visible to doxygen parser?
Workflow: doxygen run >parsing from files>create a pdf
The final generated file is missing the structure documentation inside .c file but all other structures inside a separate .h files are documented and find their place in generated .pdf file
Why missing?
What I tried: I have tried giving those structure names (which I thought missing in the documentation) in the .tex file automated part as \input{structt_Ref2_Control} then I am getting an omake error saying:
"The .tex (relevant for missing structure) file is missing"

adding latex packages to doxygen can not work

I want to add some graphics to my doxygen generated output. For that I need to add some more packages:
\usepackage{tikz}
\usepackage{tikz-timing}
\usetikzlibrary{mindmap}
\usetikzlibrary{arrows,shadows}
The first two lines can be added to the Doxyfile with
EXTRA_PACKAGES = {tikz} \
{tikz-qtree}
But the 2 other ones are not.
Is there a chance to add a .tex file into the generated output files before pdflatex starts?
Adding
LATEX_EXTRA_STYLESHEET = packages.tex
will not work. It used my file but the output is broken. Seems that the packages are loaded at the wrong place or time.
The third thing i tried was writing a header file with
doxygen -w latex ....
This works and changing the header.tex file is ok, but this ends up in always in generating the header, patching the header, run doxygen again with own header. This is very stupid!
Any idea?
The EXTRA_PACKAGES option is equivalent to the \usepackage tag in Latex. This of course doesn't work for the \usetikzlibrary tags.
You can add your modified Latex header using the tag LATEX_HEADER in the Doxyfile, e.g.:
LATEX_HEADER = ./templates/latex/YourCustomHeader.tex
Then Doxygen pulls this Latex header file when generating the documentation. In this file you can add the used packages and libraries.
By the way: The custom stylesheet isn't used before you run the make.bat script, so it is sufficient if you copy the modified 'doxygen.sty' file to the output folder after Doxygen generated the Latex files, but before you run the 'make.bat' script to generate the PDF file. I do this by a script which first calls doxygen then copies the necessary files to the output folder and finally calls the 'make.bat' script...

How to include LaTeX snippets directly in Doxygen comments?

I would like to be able to edit LaTeX parts of some Doxygen comments externally with some suitable editor. I would use that only for complex environments. To do that, I figured I can have LaTeX-only files and include them from Doxygen. I did create Doxygen aliases for \begin and \end to make the syntax compatible.
(For example, I know how to set-up Emacs/AUCTex for working with LaTeX snippets that have no preamble and document structure.)
Is there a way to include the contents of a .tex file inside a Doxygen comment? I look for something analogous to \htmlinclude, but for TeX files. Is there some way to emulate the functionality, given my requirements for having a TeX-only external source?
You may use something like
\latexonly
\input <file>
\endlatexonly
where <file> is the path to the file to include, either absolute or relative to the directory in which the latex documentation is generated.
Have you tried the \verbinclude command? This command includes any file verbatim in the documentation (in contrast to \include, which is used to include source files).
From the doxygen manual:
\verbinclude <file-name>
This command includes the file <file-name> verbatim in the documentation. The command is equivalent to pasting the file in the documentation and placing \verbatim and \endverbatim commands around it.
Files or directories that doxygen should look for can be specified using the EXAMPLE_PATH tag of doxygen's configuration file.
Edit: I just had a thought that you may wish to strip the preamble from your .tex file before including the rest of the file in the documentation. you could do this using the \dontinclude command which, together with the \line, \skip, \skipline, and \until commands allows you to include specific lines/blocks of a particular file. See the example in the \dontinclude documentation.

Compiling LaTex bib source

I am writing my thesis in Latex, and I have the references in an own thesis.bib
file which look as follows
#Article{xxx,
author = "D.A. Reinhard",
title = "Case Study",
year = "1985",
}
and I reference them in my main document as ~\cite{xxx}
When I compile then the main document with: pdflatex main.tex than
it shows me question marks instead of the proper references to the bibliography.
Do I also need to compile the bib source on its own? If yes, can somebody please
tell me the command for Linux
Many thanks!
You need to compile the bibtex file.
Suppose you have article.tex and article.bib. You need to run:
latex article.tex (this will generate a document with question marks in place of unknown references)
bibtex article (this will parse all the .bib files that were included in the article and generate metainformation regarding references)
latex article.tex (this will generate document with all the references in the correct places)
latex article.tex (just in case if adding references broke page numbering somewhere)
You have to run 'bibtex':
latex paper.tex
bibtex paper
latex paper.tex
latex paper.tex
dvipdf paper.dvi
I am using texmaker as the editor.
you have to compile it in terminal as following:
pdflatex filename (with or without extensions)
bibtex filename (without extensions)
pdflatex filename (with or without extensions)
pdflatex filename (with or without extensions)
but sometimes, when you use \citep{}, the names of the references don't show up. In this case, I had to open the references.bib file , so that texmaker could capture the references from the references.bib file. After every edition of the bib file, I had to close and reopen it!! So that texmaker could capture the content of new .bbl file each time. But remember, you have to also run your code in texmaker too.
Just in case it helps someone, since these questions (and answers) helped me really much; I decided to create an alias that runs these 4 commands in a row:
Just add the following line to your ~/.bashrc file (modify the main keyword accordingly to the name of your .tex and .bib files)
alias texbib = 'pdflatex main.tex && bibtex main && pdflatex main.tex && pdflatex main.tex'
And now, by just executing the texbib command (alias), all these commands will be executed sequentially.

Odd Bibtex behaviour in a Latex document

I added a line "\cite{test}" as a test to my working Latex document. When I compiled the bibtex "!bibtex name_of_my_file, I got the expected error:
Warning--I didn't find a database entry for "test"
Then, I removed the line and compiled the bibtex again, hoping to have a working Latex file again. However, the same error occurs, even with a fresh shell. I cannot understand the behaviour. What is the logic? How can I get my Latex document working again?
[Updated Info]
The problem dissapeared as unexpectedly as it emerged. I have no idea why but it works now. Do you know the reason for the odd behaviour?
I think you are tripping over the multi-pass nature of LaTex plus Bibtex. If you look at Step 3 in this discussion, you'll see the following:
The first run (through latex)
generates an auxiliary file,
paper.aux, containing information
about citations (and other types of
references), the bibliography style
used, and the name of the bibtex
database. The second run (through
bibtex) uses the information in the
auxiliary file, along with the data
contained in the bibtex database, to
create a file paper.bbl. This file
contains a thebibliography environment
with \bibitem entries formatted
according to the bibliography style
specified.
So, what I think is happening is that your name_of_my_file.aux file still contains your placeholder \cite{test}. If you remove the auxiliary file, you should be able to start over with:
latex name_of_my_file
bibtex name_of_my_file
latex name_of_my_file
latex name_of_my_file
[Update based on additional info]: The problem was that you had a .aux file with your \cite{} still embedded. The second time that you ran latex, you overrode the old file with the new. That's why the complete set of steps includes an initial latex call, a bibtex call and two follow-up latex calls. Think of it as a multi-pass compiler and it might be more intuitive.
You could have a look at latexmk, which will take care of the fix point compilation for you.
Anyway, you should be able to build the document (pdflatex blah.tex), even if you're missing a bibliography item. The corresponding references will just appear as question marks in the PDF.
Rerun latex to regenerate the aux file.
Have a look at this discussion for pointers to a bit more information. Basically, you may have taken your citation out of the .tex file, but it still exists in one of the derived files (aux, bbl, whatever...)
Check if your bib file has the extension .bib and not .tex.
If it is .tex, just change it to .bib and that should do it.
Once I changed it accidentally to tex, by adding some references, and saving it with the "save as" option, without specifying the bib extension. That's how it can happen all of a sudden.
delete all your .aux and temporal files, re run with latex and then bibtex and then latex twice.

Resources