0

I am trying to solve an input issue with the use of the import package but I still have the error it was supposed to solve. So I suppose I don't use it correctly.

Minimal example

arborescence

test.tex

/style_files/pstricks-base/latex/pstricks.sty

/style_files/pstricks-base/generic/pstricks.tex

/style_files/pstricks-base/generic/pst-fp.tex

Files

The pstricks files are from the pstrick-base package. All those files are present in /style_files/pstricks-base.

test.tex

\documentclass{beamer}
\usepackage{import}
\import{style_files/pstricks-base/generic/}{pstricks}
\makeatletter
\def\input@path{{style_files/pstricks-base/latex/}{style_files/pstricks-base/generic/}}
\makeatother

\usepackage{pstricks}

\begin{document} \begin{frame} Hi ! \end{frame} \end{document}

Error

When I run pdflatex test.tex I get

(./style_files/pstricks-base/generic/pstricks.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex))))
! I can't find file `pst-fp.tex'.
<to be read again> 
                   \def 
l.47 \def
         \XKV@ch@ckch@ice#1#2#3{%  bugfix for xkeyval

When I change (line 44 of pstricks.tex)

\ifx\PSTFPloaded\endinput\else\input pst-fp.tex\fi

to

\ifx\PSTFPloaded\endinput\else\input style_files/pstricks-base/generic/pst-fp.tex\fi

the error changes to the next \input issue.

I tought using import would correct that but apparently not. What is the correct way to use import here ?

More context

In case my global approach is not the good one, I describe here what I want to do. Any advice are welcome.

I have a presentation created on Overleaf I want to be able to create directly from my computer. So I have to have some packages present on Overleaf but not on my computer.

However, I don't want to install them and I want to put them into the style_files folder. That's why I use \def\input@path to import the packages even if I read that's not the optimal way.

Ccile
  • 400
  • You shouldn't load packages with \import or \input, but with \usepackage. The point of packages is to be reusable, so they are not supposed to be tied to one project, and if they are modified, I'd just put all the modified files (just those) in the same folder as your .tex file. Are yours modified? Why don't you want to install the packages? If you want them only accessible to your user you can put them in e.g, ~/texmf/tex/latex. Last resort you can set the TEXINPUTS variable, but I wouldn't. – frabjous Jun 07 '22 at 15:47
  • @frabjous I don't load package with \input. I use a package (pstricks) that is based on tex files that use \input. I didn't write this package.

    I know packages are not meant to be tied to one project but as I work on more than one computer it would be easier for me to tie them to this project and not install the packages every time I change the computer. I know it's not the best practice in general, but in that case, it's easier for me.

    I don't understand your question about modified files. I only modify the equivalent of test.tex file.

    – Ccile Jun 07 '22 at 17:44
  • You're loading the package with \import in the mwe, which is a wrapper to \input. Don't do that. How many computers are you switching between that you can't just install the packages on all of them? pstricks isn't exactly some obscure package you'd only ever use once. If you really must, look at the solutions here, or set TEXINPUTS when you compile, or create a symlink from inside ~/texmf/tex/latex to the folder in question. – frabjous Jun 07 '22 at 18:55
  • @frabjous I thought I was importing the tex file (pstricks.tex) and not the sty file. I use 2 computers and I will give them back to work soon. If I used my own computer, I would have install it but that's not the case. Moreover, those files might be share with other people that are NOT familiar with computers at all. So I would rather give them something they can use directly instead of making them install the packages – Ccile Jun 07 '22 at 22:16
  • These people need to have TeX installations. If they have MikTeX it will autoinstall packages when needed, and if they're using TeXlive/MacTeX they'll already have it installed unless they chose a very minimal scheme to start with, and even that can be remedied. I'm not sure there's a way of doing what you want without putting them all in the same folder as your file, or modifying the package yourself so it knows where to look for the stuff it imports. The import package was not designed for packages and their dependencies. Bundling fairly standard packages with your file is not normal. – frabjous Jun 08 '22 at 00:03
  • Ok so I guess I'll modify the files. I know it's not normal, but trust me, by being a sort of computer scientist and working with people that do not know computers, you have to do some concessions about what's normal or not.

    Thanks for your answers

    – Ccile Jun 08 '22 at 08:43

0 Answers0