LyXProblems Using Hyperref

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
crgonzalez4611
Posts: 7
Joined: Mon Mar 24, 2014 3:48 am

Problems Using Hyperref

Post by crgonzalez4611 »

Hello,

I am working on my thesis using LyX. I am running into trouble with the hyperref support. Without it, the thesis outputs just fine but when I turn hyperref on in Document > Settings > PDF Properties it does not work. It gives me the following error:

Code: Select all

Undefined Control Sequence.

\begin{acknowledgments}
                            
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
And identical errors for the following (instead of \begin{acknowledgments}: \listoftables, \listoffigures, \begin{abstract}.

I have no idea what is going on. I am no expert in LaTeX or LyX but I know you would want the files to help me so they are attached. Useful information follows below the signature line.

Thanks for your help,

Carlos

Machine:
Windows 7 Enterprise (64-bit)

Software:
LyX 2.1.0
MiKTeX 2.9

Document:
No content (paragraphs, figures, tables, bibliography entries) included.

Document Class:
Another student gave me customized .cls and .layout files (based on report class) for the requirements of my school. Both files are in the attachment. I am currently running them as a local layout (i.e. the class is not installed in MiKTeX or LyX system folders).

Bibliography:
.bib file made using Jabref 2.10. I am using jfm.bst as my style. I have it installed in the MiKTeX system folder but I have also included it in the attachment.
Attachments
Thesis Files.zip
(23.08 KiB) Downloaded 568 times
Last edited by cgnieder on Tue Jun 17, 2014 12:09 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

StarValkyrie
Posts: 89
Joined: Fri Jan 24, 2014 12:42 am

Re: Problems Using Hyperref

Post by StarValkyrie »

Your cls file is not a local layout. Layout files talk to LyX about what to put on the screen as you're typing. It doesn't know what to do with the cls code when you put it there. Either paste the contents of the cls file into the Preamble or put the file in the same folder as your document and call it from the Preamble.
crgonzalez4611
Posts: 7
Joined: Mon Mar 24, 2014 3:48 am

Re: Problems Using Hyperref

Post by crgonzalez4611 »

Poor choice of words on my part. I meant I have both .cls and .layout files on the same folder as the thesis .lyx files. What I did was that I went to Document > Settings > Document Class and selected the .layout file using the "Local Layout" button. Like I said, the document output just fine without the hyperref. Just as I turned the hyperref on, it did not work.
StarValkyrie
Posts: 89
Joined: Fri Jan 24, 2014 12:42 am

Re: Problems Using Hyperref

Post by StarValkyrie »

Ok, I understand now. Well your layout file looks fine. You call natbib three times and nomencl twice in your preamble, but that won't cause what's happening. Those error messages aren't very helpful. I'd blame the cls file because there's not a whole lot else in these minimal examples, but a cursory glance at it didn't spot anything that stood out (other than my personal pet peeve of not changing the first line of frankensteined code to the name of the new cls file). It is totally possible that if someone who knows writing cls files better than me takes a look, they might find something. However...

I then took all your LyX documents and exported them to TeX, opened them in TeXWorks and fixed the input strings to point to the TeX documents (remember - no spaces in your file names/paths for your actual documents!) and hit compile. It worked with no errors and no other changes to your test documents so its possible this is A) a problem with the input of files via LyX (I tried adding the lyx files via Insert, File, Child Document though and that didn't help), or B) a LyX bug of some sort - it has always had problems with hyperref so I wouldn't be surprised and there's not much that can be done about that if it is. I'd suggest talking to your fellow students and professors to see if anyone else is having this problem and what they're doing about it. If this is a LyX bug, I'd expect someone else to be having this problem too. Sorry I can't be of much help. Worst case scenario, you might have to A) work in TeX for real without LyX in between you and the code, or B) work in LyX and then export it to LaTeX and do the compiling in a TeX processor (if you choose this option, make frequent backup copies and do a test export and compile often to make sure you catch any errors as soon as possible so you don't have to troubleshoot a whole thesis document up against your deadline).
crgonzalez4611
Posts: 7
Joined: Mon Mar 24, 2014 3:48 am

Re: Problems Using Hyperref

Post by crgonzalez4611 »

Thanks for your trying. I know it was a lot of files so thanks for taking a look. If I can't find a solution for this, I might have to learn LaTeX and work in TeXworks instead, like you suggested.

Since I posted the topic, I tried exporting a blank file (no preamble, no math packages, no modules, only natbib citation style selected) with the class and it worked just fine... as long as hyperref is off.

I also tried using the thesis files and commenting out the preamble one line at a time. Still no luck with getting hyperref to work or finding any conflicts with the packages I am using.

I now think (especially after your response) it is something in the .cls and/or .layout file(s). Like I said, I got the class files from another student so I have not touched them. It is very possible that whoever coded the class files made a mistake.
StarValkyrie
Posts: 89
Joined: Fri Jan 24, 2014 12:42 am

Re: Problems Using Hyperref

Post by StarValkyrie »

I don't know what I had going last night but I couldn't recreate it this morning which is probably just as well because I went back and fixed the errors in the cls instead and now it seems to be working correctly within LyX. The problem was with the MakeUppercase in just the sections throwing up error messages so I hard-coded the titles in all caps instead which is bad form but at least it does compile. Cls file attached. Just swap it for the one you have in your document folder and continue using LyX as usual.
Attachments
lsuetd2.cls
(27.67 KiB) Downloaded 584 times
crgonzalez4611
Posts: 7
Joined: Mon Mar 24, 2014 3:48 am

Re: Problems Using Hyperref

Post by crgonzalez4611 »

Thanks so much for your help. It worked. Just needed to add a few phantom sections in the front matter and in the back matter.

I could not have submitted my thesis as it was before. I am required to submit a PDF file with bookmarks and cross references and now I have everything I need to start writing. Thanks.
Post Reply