LyX ⇒ classicthesis | LyX vs. LaTeX Search Path
classicthesis | LyX vs. LaTeX Search Path
I have been looking for an option to add the folder where the currently active file resides to the LaTeX search path in LyX.
I searched the fora thoroughly, and found this post: http://www.latex-community.org/forum/vi ... 19&t=13381, where somebody's problem arises from similar circumstances (just the 1st post).
OS is Windows 7, using MikTex 2.9.
Unfortunately, the solution then goes into a direction which does not work for me.
I am using the classicthesis package (current version) with the *.layout file placed at %APDDATA%\LyX2.0\layouts.
The package mainly consists of the two files classicthesis.sty and classicthesis-preamble.sty, where the latter is loaded by the LyX setting and in turn loads the main file classicthesis.sty.
I have modified the file classicthesis-preamble.sty as told by the documentation, which defines a few commands such as \myName, \myDepartment etc., to use my personal information.
Both *.sty files are placed in the same directory (call it $folder) as my *.lyx file.
The following steps then reproduce the error:
I created a new LyX-document doc.lyx and put the LaTeX-Code "\myName" inside. Set the document class in the Document Settings dialog to "classicthesis".
When I create a *.pdf file via pdflatex in LyX, all I get to see is the standard value (name of the package author), as if I hadn't modified anything.
On the other hand, if I export the document to "Latex (pdflatex)" and compile it manually via "pdflatex doc.tex", everything works as intended.
I was able to isolate the problem: Apparently, LyX uses a different package search path. Running "kpsewhich classicthesis-preamble.sty" inside $folder gives the intended output $folder/classicthesis-preamble.sty.
But LyX does not seem to look there and asks MikTex to install the missing package. If I then modify the file %appdata%\MiKTeX\2.9\tex\latex\classicthesis\classicthesis-preamble.sty, it correctly shows up.
This is kind of a kludge, because the file also contains variables which are specific to the current document and thusly better changed in the local version inside $folder. I am posting this in detail so anybody who might encounter a similar problem can find this.
So, in the end, the question remains: How do I coax LyX to load any package from the current folder first before trying the repository?
Stuff I tried:
*Renaming classicthesis-preamble.sty and including the renamed file. Gives the problem that all those commands are already defined inside the MikTex-version which is included by LyX at an earlier point and therefore my newer definitions are discarded. Also, seems kludgy.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: classicthesis | LyX vs. LaTeX Search Path
So, let me rephrase and boil it down:
How does LyX locate LaTeX *.sty files in general, and especially ones which might be included through a *.layout file?
Is there any way to tune the mechanism involved in resolving \usepackage{} directives in LyX?
Thanks!
classicthesis | LyX vs. LaTeX Search Path
1. Downloaded ClassicThesis package for LyX.
2. Created a new directory, let's call it Test and placed both .sty files, together with .layout file into it. Also, I saved my .lyx file into this directory.
3. In LyX: Document > Settings > Document Class > Local Layout, and then set "classicthesis.layout" from Test dir as my document class.
AFAIK, LyX respects LaTeX path, so I'm not sure what went wrong in your case. All I can say is to try reconfiguring LyX (Tools > Reconfigure), then restart it and try compiling your document again.
Also, .sty files in working directory should take precedence over those installed in system dirs.
classicthesis | LyX vs. LaTeX Search Path
I tried that, but it gave the same results. I am using Lyx 2.0.0-3 and MikTex (v2.8 and 2.9, tried both on different computers).meho_r wrote:Here's what I did and it worked:
1. Downloaded ClassicThesis package for LyX.
2. Created a new directory, let's call it Test and placed both .sty files, together with .layout file into it. Also, I saved my .lyx file into this directory.
3. In LyX: Document > Settings > Document Class > Local Layout, and then set "classicthesis.layout" from Test dir as my document class.
I thought so, too, and it does work this way if there is no package which also contains a file of the same name.meho_r wrote: AFAIK, LyX respects LaTeX path, so I'm not sure what went wrong in your case. All I can say is to try reconfiguring LyX (Tools > Reconfigure), then restart it and try compiling your document again.
Also, .sty files in working directory should take precedence over those installed in system dirs.
If I set MikTex to always ask me if there is a new package to be installed and manually delete classicthesis-preamble.sty inside the MikTex directory, the file from my working directory is used.
The workaround I finally settled with is modifying the .layout file so it requests "classicthesis-preamble_custom", which is just a renamed version inside my working directory.
Are you also using MikTex? Maybe the problem is not related to LyX. On the other hand, I could very well imagine this being some untested niche case, as the need to keep a copy of some standard package in the working directory seems to be fairly sparse.
classicthesis | LyX vs. LaTeX Search Path
Maybe it is sparse, but it is crucial that things work as expected. E.g., you might want to make sure your documents are portable and compilable in future, so you decided to include all packages used in a doc in the same dir where your .lyx or .tex files reside (sort of backup; this is what bundledoc do). Having these packages later ignored will most certainly lead to serious issues.sheepd wrote:...
Are you also using MikTex? Maybe the problem is not related to LyX. On the other hand, I could very well imagine this being some untested niche case, as the need to keep a copy of some standard package in the working directory seems to be fairly sparse.
I use TeXLive 2010, LyX version is 2.0. Now I wonder if this has something to do with MikTeX. Unfortunately, I cannot be of any help there.
-
- Posts: 10
- Joined: Sat Sep 10, 2011 10:59 pm
Re: classicthesis | LyX vs. LaTeX Search Path
For now, changing the name of the classicthesis-preamble.sty, and modifying the line with the same name in classicthesis.layout should make things work.
Re: classicthesis | LyX vs. LaTeX Search Path
One more thing I would suggest is putting the text-width settings (the \areaset stuff) also inside the preamble file, so it can be modified on a per-document basis.
I wrote my bachelor's thesis with classicthesis (preparing a postcard, by the way

-
- Posts: 10
- Joined: Sat Sep 10, 2011 10:59 pm
classicthesis | LyX vs. LaTeX Search Path
I don't think this is ever going to happen, A.M. is very conservative on changing classicthesis.sty (for lots of reasons)sheepd wrote: One more thing I would suggest is putting the text-width settings (the \areaset stuff) also inside the preamble file, so it can be modified on a per-document basis.
But what you can do is redefining the areaset commands in the LaTeX preamble of your LyX document(s):
Code: Select all
\areaset[current]{336pt}{750pt} % ~ 336 * factor 2 + 33 head + 42 \the\footskip
\setlength{\marginparwidth}{7em}%
\setlength{\marginparsep}{2em}%
I'm sure the author will be very glad to receive itPreparing a postcard, by the way![]()
