0

In a prvious question (How to change 'et al' to italic font in citation call-outs, with 'agsm' bibliography style), the answer by Mico tells us to place the modified .bst file in the "directory that's searched by BibTeX." However, the answer does not exactly specify what that directory is and how to change it. (of course I know that this varies depending on the version of the LaTeX distribution, the username and the operating system, but I still want to get a rough idea as to where I it is when using MiKTeX and Windows).

Further, I tried to rename IEEEtranN.bst to IEEEtranN-mod.bst while leaving both files in the original directory of IEEE bst files. Then I used \bibliographystyle{IEEEtranN-mod}, but it does not seem that BibTeX was able to find that file. Why can BibTeX use the original IEEEtranN but not the modified one when both of them are in the same directory?

Here is a sample of my code for testing

\begin{filecontents*}{sample.bib}
@article{aldaoudeyeh2016,
    title={{Photovoltaic-battery scheme to enhance PV array characteristics in partial shading conditions}},
    author={Aldaoudeyeh, Al-Motasem I},
    journal={IET Renewable Power Generation},
    volume={10},
    number={1},
    pages={108--115},
    year={2016},
    publisher={IET}
}
@ARTICLE{wu2017,
    title={{Assessing Impact of Renewable Energy Integration on System Strength Using Site-Dependent Short Circuit Ratio}},
    author={Wu, Di and Li, Gangan and Javadi, Milad and Malyscheff, Alexander M and Hong, Mingguo and Jiang, John Ning},
    journal={IEEE Transactions on Sustainable Energy},
    year={2017},
    publisher={IEEE}
}
@article{wu2019,
    title={A method to identify weak points of interconnection of renewable energy resources},
    author={Wu, Di and Aldaoudeyeh, Al Motasem and Javadi, Milad and Ma, Feng and Tan, Jin and Jiang, John N and others},
    journal={International Journal of Electrical Power \& Energy Systems},
    volume={110},
    pages={72--82},
    year={2019},
    publisher={Elsevier}
}
\end{filecontents*}

\documentclass[]{book}

\usepackage[x11names, svgnames]{xcolor}


%\usepackage[square, nonamebreak, sort&compress, comma]{natbib} % For IEEE
\usepackage[round]{natbib}
\newcommand{\citeauyear}[1]{%
    \citeauthor{#1}~[\citeyear{#1}] [Ref. \citenum{#1}]}


% C:\Users\almot\AppData\Local\Programs\MiKTeX 2.9\bibtex\bst\ieeetran


\usepackage{hyperref}
\hypersetup{citecolor=SlateBlue2, citebordercolor=SlateBlue2, 
    linkbordercolor=DodgerBlue3, linkcolor=DodgerBlue3, urlcolor=Blue1, colorlinks=true}


\begin{document}

\citeauyear{wu2017}, \cite{aldaoudeyeh2016,wu2019,wu2017}

\newpage
\bibliographystyle{IEEEtranN}
\bibliography{sample}

\end{document}
  • I wrote "[a] directory that's searched by BibTeX" in that earlier answer deliberately: BibTeX potentially searches several directories. However, which directories are searched depends importantly on which TeX distribution is in use. Since no information was provided about the latter topic, writing "[a] directory that's searched by BibTeX" was indeed the best I could do. – Mico Apr 27 at 13:16
  • @Mico. I know that this depends on the operating system and LaTeX distribution. However, I would like to know where to look when I use MiKTeX 2.9 and Windows. I want to use a custom .bst file for multiple documents, but without saving multiple copies of that file in the folder of each .tex file – Al-Motasem Aldaoudeyeh Apr 27 at 13:20
  • Your second question is, "Why can BibTeX use the original IEEEtranN but not the modified one when both of them are in the same directory?" I suggest you re-read the second part of the paragraph from which you provided an excerpt. The second part was, "be sure to also update the filename database of your TeX distribution appropriately". As you've (re)discovered, placing a file in a directory that's searched by BibTeX is not enough; one also has to update the filename database "appropriately". And what's appropriate depends, you guessed it, on the TeX distribution. – Mico Apr 27 at 13:24
  • MikTeX provides a utility to update its filename database. – Mico Apr 27 at 13:25
  • @Mico. Ah, I got it. since BibTeX looks for the directory of IEEE bst files, then a file there should be reached by BibTeX when looking for texmf root directories, even if it was not installed automatically by MiKTeX. After creating a new file and updating it, the filename database can be updated by opening MiKTeX Console then clicking Tasks --> Refresh filename database. It is only that we tell MiKTeX to scan all of subfolders of the textmf root for any new file. – Al-Motasem Aldaoudeyeh Apr 27 at 13:59
0

Place your files in your texmf folder. Where this folder is depends on the OS

(if these folder structure does not yet exist, create the necessary folders)

If the file is still not found after placing it there, run texhash from the command line

  • Would that be C:\Users\username\AppData\Local\Programs\MiKTeX 2.9\bibtex\bst\bibtex for Windows and MiKTeX 2.9? – Al-Motasem Aldaoudeyeh Apr 27 at 12:58
  • 1
    @Al-MotasemAldaoudeyeh No, that is the location for files part of miktex, not for your personal files. Don't place your own files there, otherwise they might be deleted when the tex distribution is upgraded. – mike Apr 27 at 12:58
  • there is no folder called texmf in my user folder, not even in any sub-directory – Al-Motasem Aldaoudeyeh Apr 27 at 13:05
  • 1
    @Al-MotasemAldaoudeyeh If there is no such folder, create it – mike Apr 27 at 13:07
  • @Al-MotasemAldaoudeyeh - I'm pretty sure that MikTeX provides a utility program to (a) define one or more local directory trees -- you should always place your own files in a local directory tree; whatever is in MikTeX's directory tree could get overwritten or wiped out without warning during an update of the MikTeX distribution -- and (b) update its own filename database. – Mico Apr 27 at 13:30
0

Many changes in Kpathsea priority can be controlled by EnvVars and for bibtex there are two dedicated (others related to packages mention TEXBIB and MLBIBINPUTS but these may be more program specific)

The default location for the bibtex files for a document are in the same directory as that document. Also a complex set of searching described here https://tug.org/texlive/doc/texlive-en/texlive-en.html#x1-550007.1

It may be best to align the standard bib variables with the TDS personal defaults (see below) these examples are for guidance not necessarily true working examples, you need to adjust for your own usage.

../ is useful for the parent folder in projects with an \input\subdirectory ./ is including current folder

In Windows use "setx" ONLY ONCE for each entry (it will become active on reboot)

setx BIBINPUTS=../;./;%HOME%/texmf/bibtex/bib/misc;
setx BSTINPUTS=../;./;%HOME%/texmf/bibtex/bst/misc;

A windows user logout/logon may not be sufficient. e.g. similar to advice from other support forums "after editing ~/.bash_profile, you [may] have to reboot your Mac."

You could use TEXINPUTS.bibtex= (see below) but that would probably be overkill and potentially much more difficult to manage

a path order such as ‘.:$TEXMF//’, will force ./texmf.cnf to override those from $TEXMF/tex/texmf.cnf or below

This is a common reason that you are told to place overriding or missing files in the .tex directory

The following are just a very small selection of override locations that can be sequenced

latex2e_inputs = .:$TEXMF/tex/latex//:$TEXMF/tex//
TEXINPUTS.latex2e = $latex2e_inputs % will override TEXINPUTS= whilst latex2e is compiling
TEXINPUTS = .:$TEXMF/tex// should override config files as shown above
TEXMFCNF Config files such as config.ps or texmf.cnf should override defaults

Defaults for TeX TDS compliant systems (Mac TeX / MiKTeX / TeX Live / W32TeX etc.)

/usr/local/share/texmf/ = TDS root (path will differ for some systems e.g. windows)

/usr/local/share/texmf/bibtex/bib/base/(e.g., ‘xampl.bib’)
/usr/local/share/texmf/bibtex/bib/misc/single-file databases
/usr/local/share/texmf/bibtex/bib/pkg/name of a package

/usr/local/share/texmf/bibtex/bst/base/(e.g., ‘plain.bst’, ‘acm.bst’)
/usr/local/share/texmf/bibtex/bst/misc/single-file databases
/usr/local/share/texmf/bibtex/bst/pkg/name of a package

If these system defaults are not there the only one that will always work is the current directory OR any set by MiKTeX in its texmf path but the structure should be TDS so you need to check your %HOME% location then add a texmf folder then add a bibtex sub folder and in that a bib and bst folder both with a misc subfolder

In MiKTeX you point to and ADD the texmf that is located in %HOME%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.