I usually use TeXmaker to edit and compile my .tex files. I am trying to figure out where I should put the file my-package.sty, so that I can use it by simple adding \usepackage{my-package} to the preamble of any .tex file.

I found several related answers suggesting using kpsewhich and related commands, such as

However, on my system it seems that TeXmaker can find packages that neither kpsewhich nor pdflatex can find. For example, TeXmaker can compile the following file example.tex without error, and produces the correct output.


But pdflatex example.tex generates the error message

! LaTeX Error: File 'lipsum.sty' not found.,

and kpsewhich lipsum.sty returns nothing.

Does this mean that there are more than one version of pdflatex installed on my system? If so how do I check/configure which version TeXmaker uses? (I'm using MacOS 10.11.6 and Texmaker 4.5 is installed using Macports)

Please share your thoughts. Thanks!

  • 1
    Then you seem to have two different latex installations. Texmaker cannot find any latex packages, it leaves that to latex. To when you call latex via texmaker and via the command line you seem to get two different latex installations, look in the generated log files, they will tell. Exactly how did you add the mac ports installation? And why are you using the mac ports version and not mactex which is the easiest latex to install. – daleif Mar 1 at 12:42
  • The editor can re-direct the texmf paths such that at editor runtime there are more than available from the default paths in the system when running in a console, these environment variables (and there are many) include those such as texinputs etc HOWEVER on running texmaker 4 in Tex Live without system defined env settings and shelling to a terminal I see no additions (that does not mean that texmaker is not using some internally, or if I ran in MiKTeX it can add them prior to texmaker starting) so I would If I wanted to control them add them to my start-up script(s) – KJO Mar 1 at 13:22
  • @daleif Thanks a lot ! Indeed, the two log files (generated by TeXmaker and command-line) show different latex versions. The file executed in the terminal was easy to locate using the which command. Is there a good way to locate the executable file used by TeXmaker? (I figured it out by looking into all the locations in my $PATH variable in the terminal, but I doubt it is the right way to do it.) p.s. I used MacPorts because when I changed from Linux to Mac, I wanted a bunch of other Linux-native programs, then I got lazy and installed TeXmaker with them... – Linxiao Mar 1 at 14:58
  • Again texmaker does not search, it just calls the latex it sees. My guess: you've made the same error we often see on linux: add the path change in dot.bashrc which is never seen if texmaker is started via a menu or double clicking. This is one of the reasons why we often recommend mactex as it just works. – daleif Mar 1 at 16:57

Your Answer

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

Browse other questions tagged or ask your own question.