2

I've just installed a gantt chart package, which I'm trying to use it in LyX.

I attempted to use the first minimal example, but this failed in LyX with LaTeX Error: File 'forloop.sty' not found. However, compiling the pdf from raw LaTeX works fine. I attempted both creating the example file from scratch, and exporting the LaTeX (plain) from LyX, and attempting a manual pdflatex example.tex. This worked in both cases.

Back in LyX, I tried following the instructions on the wiki. Specifically,

$ kpsewhich forloop.sty
./forloop.sty
$ sudo texhash
texhash: Updating /etc/texmf/ls-R... 
texhash: Updating /usr/share/texmf/ls-R... 
texhash: Updating /usr/share/texmf-dist/ls-R... 
texhash: Updating /var/lib/texmf/ls-R... 
texhash: Done.

Then in LyX, Tools→Reconfigure and restart. It still failed with the same error. How can I fix this problem in LyX?

I'm using LyX 2.1.1 and on Arch Linux. pdflatex details are below.

$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014/Arch Linux)
kpathsea version 6.2.0
...
Compiled with libpng 1.6.13; using libpng 1.6.13
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with poppler version 0.26.5

Details of the LyX file

I created a new LyX file, and put the following into the header.

\usepackage{tikz}
\usepackage{gantt}

I then created ERT and copy pasted from the first minimal example here, from \begin{gantt}{10}{12} to \end{gantt}.

2

My best guess is that you did not install the forloop.sty file correctly, but just save it to the folder, where you have your project. If this is the case, it will work with pdflatex, as pdflatex will install search you current directory for .sty files, but LyX will not. To install a package you have to choices. You can use the texlive install utitlity, if the package is aviliable in the texlive mirror.

tlmgr install <package1> <package2>

If not you need to create a new texmf folder (typically in ~/texmf/) and then make a subfolder in ~/texmf/tex/latex/forloop/ and save your forloop.sty file to there. Then run

texhash ~/texmf

For TeX to recognize your package

  • Sorry, I was halfway typing a response to your comment. locate forloop.sty finds nothing at all on my system. Oddly enough, pdf creation still works with from the command line though. – Sparhawk Oct 24 '14 at 12:27
  • Locate only works if you manually updated the system file database (nothing to do with latex, update using sudo updatedb). For latex files use kpsewhich file.sty – daleif Oct 24 '14 at 14:56
  • @daleif Yes, sorry, I did sudo updatedb first. However, I've just realised that half my problem was I was running the cli pdflatex from /tmp, which did contain forloop.sty. It's all working now (although I'm still clueless as to why LyX didn't work even after I'd applied the fixes as per my question). – Sparhawk Oct 25 '14 at 2:04

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.