As the name suggests - can I do something like:
\usepackage{/home/nebffa/Desktop/maths/questions/fillwithlines.sty}
LaTeX is throwing errors at me when I try to do it.
As the name suggests - can I do something like:
\usepackage{/home/nebffa/Desktop/maths/questions/fillwithlines.sty}
LaTeX is throwing errors at me when I try to do it.
\usepackage{<file>} can take a full path, but requires you to drop the file extension. That is, it assumes \usepackage{<path>/file} will include file.sty located in <path>, self-appending the extension (known as \@pkgextension). So, drop the .sty.
The following MWE reproduces the problem:
\documentclass{article}
\usepackage{graphicx.sty}
\begin{document}
Test
\end{document}
yielding the error message:
! LaTeX Error: File `graphicx.sty.sty' not found. Type X to quit or to proceed, or enter new name. (Default extension: sty)
\usepackage does not match the package name in \ProvidesPackage of the package file: LaTeX Warning: You have requested package "...", but the package provides "...".
– Heiko Oberdiek
Oct 14 '13 at 06:39
\usepackage{../mypkg}
– yo'
Oct 14 '13 at 07:13
\ProvidesPackage system is to warn users of that.
– David Carlisle
Oct 14 '13 at 09:46
Instead of using a full path, it is a much better practice to put your file in an appropriate place where TeX will find it. It seems you are a *NIX user, so you may try
$ less `kpsewhich texmf.cnf`
to know which places are these. There is a lot of comments in this file, they will help you. Alternatively, you can use the TEXMFHOME or the TEXINPUTS environment variable. Their use is detailed in texmf.cnfas well.
You probably want to distinguish three cases of use for your software package mypackage:
Site-wide installation, it is then adapted to store your TeX files in a site-wide available directory and ${TEXMFLOCAL}/tex/latex/mypackage is probably a good choice. (Use kpsexpand to know which actual path to use, as in kpsexpand '${TEXMFLOCAL}/tex/latex/mypackge').
User specific installation, the directory ${TEXMFHOME}/tex/latex/mypackage then looks appropriate.
Development, while you are developing your package, you probably want to avoid repeteadly installing TeX related files and prefer add the appropriate locations to the TEXINPUTS environment variable.
The file texmf.cnf contains useful informations about these variables.
.sty file with the package.
– nebffa
Oct 14 '13 at 12:12
\usepackage{name} and then stick name.sty anywhere on the tex input path, either the current directory or one of the standard places, or a new place that you add to the path.
– David Carlisle
Oct 14 '13 at 12:20
\input{/path/to/file.tex} and put the macros in a .tex file (starting with \makeatletter if needed.
– David Carlisle
Oct 14 '13 at 12:22
info kpathsea. If you are distributing a software package called mypackage installed system-wide, your files could go in /usr/local/share/texmf/tex/latex/mypackage or a similar path (see texmf.cnf as I wrote in my answer). If your package is installed for only one user, then your package should go in $TEXMFHOME/tex/latex/mypackage and kpsewhich --var-value TEXMFHOME tells you which values is actually considered. I would rather use the environment variable for engineering not for deployment.
– Michaël Le Barbier
Oct 14 '13 at 14:23
texmf locations into your answer. I suspect many people (don't know that they) are looking for the information contained in the comment.
– jon
Oct 16 '13 at 01:51
less \kpsewhich texmf.cnf`` only displays a very short document with "This texmf.cnf file should contain only your personal changes [...]".
– AnnanFay
Oct 21 '17 at 10:52
less \kpsewhich texmf.cnf`` also explains how to find the main distribution texmf.cnf file.
– Michaël Le Barbier
Oct 22 '17 at 01:07
kpsewhich texmf.cnf returns /usr/local/texlive/2016/texmf.cnf which contains the relative path to /usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf
– AnnanFay
Oct 23 '17 at 11:41
TEXINPUTS environment variable you probably want to append a colon so that it's default value is appended instead of overridden. Without the colon my computer did not find pdflatex anymore. [source]
– jakun
May 08 '20 at 09:36
.sty, but apart from that, there should be no problem. What kind of errors is LaTeX throwing your way? – Werner Oct 14 '13 at 05:48.styfixed it. If you make your comment into an answer I will accept it – nebffa Oct 14 '13 at 05:52