Texmaker and TeXstudioHow to add custom (BibTex) commands when compiling?

Information and discussion about Texmaker, an integrated LaTeX environment for several platforms, and the related TeXstudio
Post Reply
RiW
Posts: 29
Joined: Wed Sep 01, 2010 12:11 am

How to add custom (BibTex) commands when compiling?

Post by RiW »

Hi,

I've been using Texmaker, MikTex 2.8 and BibTex fine for a simple report. However, I'm now looking to use the software regularly and am trying to configure it for widespread use. Firstly, I have folder containing all my BibTex files (a different one for each research topic) - with path "C:\BibTex" - and I would like Texmaker to look there when compiling.

I've found this very useful article from http://julien.dutant.free.fr/blog/index ... e-in-latex ----
A nicer solution involves altering the BibTeX command. Let me first give the idea. When you run BibTeX for your TeX document, something like the following commands is executed:

bibtex MyTeXDocument
bibtex F:\My Stuff\texdocs\MyTeXDocument
Now you can tell BibTeX to lookup for the bibliography file in a different folder by using the --include-directory option:

bibtex --include-directory="F:\My Documents\mybibliographyfolder" MyTexDocument
If your Tex document includes \bibliography{MyBooks}, the command above will search for MyBooks.bib in F:\My Documents\mybibliographyfolder as well as in the Tex document's folder. (If there's a .bib file of that name in both folder, I don't know which one will be used - you try it! But there shouldn't be one in the first place!)

Now you probably don't run BibTeX by yourself, but through a TeX editor like Emacs with AUCTex, TeXnic, WinEdt or some other. So you have to find how to alter the command in the editor's options. Here's how to do with the three just listed:

Emacs with AUCTex.

In short: in the tex-command-list option, there's an entry for the bibtex command that you can alter. In detail: Menu > Options > Customize Emacs > Browse Customization Groups. A new buffer opens in which you can browse the various Emacs settings. Go to: Wp > Tex > AUCTeX > TexCommand > Tex Command List. Open it: the buffer shows a list of entries of the TeX commands that AUCTeX launches. Find the command named "BibTeX", and replace the command field:

bibtex $s
by:

bibtex --include-directory="F:\my bibliography folder" $s
Don't forget to save the new setting (at the top of the buffer, clic on "Save for future sessions").

TeXnic.

Menu > Build > Define Output Profile. A windows opens with the settings for each output profile (tex => dvi, tex => pdf, etc.). Each profile has a bibtex section. Change the field "Command line arguments to pass to BibTeX" from:

"%bm"
to

--include-directory="D:\bib test" "%bm"
Do the same for all outprofiles you use.

WinEdt

Menu > Options > Executions Modes... A window opens with several tabs. In the "Console Applications" tab, you find a list of commands. Select bibtex, and add to the "Switches" field:

--include-directory="F:\my bibliography folder"
And that's it.

(Note, if something goes wrong in WinEdt, it might be useful to look at the output of LaTeX and BibTeX (by default, the console outputs windows close just after the execution of LaTeX/BibTeX is finished. In order to read the output, go back to the Execution modes dialog box, and in the Console Attributes section click "Pause if OK".)

Notes and links

The comp.text.tex mailing list had a thread in 2001 which suggested adding a customized config file for MikTeX, but that is not possible in later versions of MikTeX: the -personal switch of initexmf has been removed.

I found the way to modify AUCTeX on the GNU AUCTeX list here. Note that changing the Tex-Run options will not work when you use AUCTeX.
-------
However, I'm having trouble porting this into Texmaker. If I click options ->configure TexMaker I get the following screen: http://www.xm1math.net/texmaker/doc14.png

I've tried copy and pasting the above options into the bibtex field but to no avail as references still don't show up in my report.
Last edited by RiW on Thu Sep 02, 2010 11:40 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

How to add custom (BibTex) commands when compiling?

Post by frabjous »

Firstly, it would be appreciated if you put quoted text insiude [ quote ] [ /quote ] tags so we can easily separate what is quoted from your request? Or better yet, just include the link, and let us click and read it by ourselves if need be..

Secondly, texmaker does not "compile" anything. It just calls the command.

You gave us a screenshot of that that page from texmaker's configuration, but you didn't tell us exactly how you changed it. What exactly did you paste in there? My guess is that the BibTeX line should be:

Code: Select all

bibtex --include-directory="C:\BibTex" %.aux
I don't know, however, whether --include-dirs="..." works with subdirectories, so you may need to link right to the subfolder for the particular topic at hand.
RiW
Posts: 29
Joined: Wed Sep 01, 2010 12:11 am

How to add custom (BibTex) commands when compiling?

Post by RiW »

Sorry, I'm new both to latex and the forum but have corrected my first post.

Ok, in the BibTex line I have tried:

Code: Select all

bibtex --include-directory="C:\BibTex" %.aux
bibtex -include-directory="C:\BibTex" %.aux
bibtex -include-directory="C:\BibTex" %
bibtex --include-directory="C:\BibTex" %
I restarted TexMaker after each setting change, as it instructed me to, but still receieved 'references not found' errors.

Does anyone please have any other ideas?
Post Reply