I am about to start writing my thesis and decided to finally learn sth other than Word. Realized that LyX has shorter learning curve than plain LaTeX so I decided to give it a shot. It is great so far and have realized how I should have done this long time ago. A bunch of things that started to cause headaches for me (mainly when writing articles) have just disappeared.
My problems started when I realized that I do have LaTeX rules for writing a thesis at my university, but there is no easy way (for me at least) to implement it in LyX. After reading a couple of similarly themed threads here, I came to the conclusion that the LaTeX files provided by my university are not templates or classes or layouts, instead, they are "just" plain .tex files.
Of course, I can open them in, let's say, TexWorks, but after a whole day of trying, I can't figure out how to import them into the LyX environment.
Is there any hint on how I should do it, i.e. how I can use the LaTeX provided rules for writing a thesis in LyX?

Welcome to TeX.SX! main.tex in your .zip file is your 'template' (And personally I doubt that one can 'learn' LaTeX by using LyX, Texmaker, TeXstudio etc.)
– user31729Oct 15 '15 at 13:06

3

First, that's a pretty unpleasant looking set of files. Second, I'd suggest going through the included PDF looking for items you'll need to change (department, supervisor, year, etc.). Find those items in main.tex or other included files and change them. Then I'd look at the files in Stephen Eglen's A short example of how to use LaTeX in scientific reports for the basics of sectioning, inserting tables and figures, etc. As @ChristianHupfer hinted at, I don't think there's any benefit to adapting the TeX files into LyX for a new user.
– Mike RenfroOct 15 '15 at 13:38

Hi, thanks for the fast response. So, basically, you are suggesting that I should forget about trying to do the thesis in LyX and instead just go with writing it directly using LaTeX? I was actually thinking whether to do it like that (since I started completely from scratch) but LyX did seem more user friendly, when writing formulas and stuff.
– tom555Oct 15 '15 at 16:29

Yes, I'm suggesting working in LaTeX. Visual editors for formulas can lead to users finding the closest visual equivalent to a symbol or operator instead of finding the right symbol from documentation (Voss' Mathmode, Gratzer's Math Into LaTeX, etc.). However, there are visual equation editors for LaTeX, too, at least inside web browsers, and some for local applications.
– Mike RenfroOct 16 '15 at 11:24

2 Answers
2

Nonetheless, said that, unlike many thesis templates, in this case main.tex do not use a custom document class but the standard book that is already supported by Lyx without any special configuration.

So you can File > Import > LaTeX (plain) ... > select main.tex. This will make main.lyx as well as lyx versions of all the subdocuments.

However, the imported file will have some problems:

1. Conflicts between the imported preamble and own LyX settings for the document. The solution is remove from Document > Settings... > LaTeX Preamble what could be fixed in other sections of Document > Settings....

Beside setting defaults margins in geometry, this is wrong mainly because the croatian option cannot be passed two times to the babel package. But you can remove both packages from the preamble and configure them through the LyX interface to produce this:

Generally the ERT boxes are not harmful (the file is still compilable) but annoying. In this case, many of these ERT are LaTeX comments that you remove safely or convert in yellow notes. Others are commands as \tableofcontents that you can replace easily by Lyx objects as Insert > List/ToC > Table of contents and some others could be LaTeX code that is better maintain "as is" since you cannot (or you do not know) replicate through the GUI of LyX (for example, the titlepage environment). If unsure, left the ERT boxes!

3. Imported images are too big on the screen. This is a minor problem easy to solve: Right-click on the image Settings... > LateX and LyX options > Scale on the screen (%) > try with a 1-10%. The image size on the PDF is not modified by this setting.

4. Conflicts inherited from converted sub documents. The conversion of the main file is not too hard but debug compilations errors due (for example) to atabularx environment infested with dozens of ERT boxes in a included subdocument will be a nightmare even for experts. Simply avoid these conflicting example subdocuments until you have a compilable main file. Then start including simple subdocuments with only some text. Remember that LyX cannot produce any type of LaTeX code, only the most common commands and environments, but you always insert unknow code for LyX as long as you use the ERT boxes, and when needed, packages/definitions in the preamble so LaTeX can understand these ERT boxes.

Hi Fran, thanks for the elaborate reply. The first thing I did was to try to import the main.tex file in LyX. Unfortunately, it gives me the "Cannot convert file" error saying >" An error occurred while running: C:\LaTeX\LyX\bin\tex2lyx -f "main.tex" "main.lyx" ". I couldn't resolve it but assumed LyX just can't import such a "complex" file. So I was maybe thinking of doing the document formatting using the rules from the .lyx file. Is there any way I can import the file to LyX? If not, I guess i will try manually...
– tom555Oct 15 '15 at 22:41

@tom555 Have you a working tex2lyx at the system prompt? I was able to convert it in Lyx 2.0.8.1 from Linux Mint with "only" the commented problems, and without some subdocument it was compilable.
– FranOct 16 '15 at 4:07

@tom555 May be easier could be start a empty book in Lyx, set margins, idiom, paste in the "LateX preamble" settings the LaTeX preamble ---forgive the redundancy :) --- without babel and geometry, and then paste the code of the 3 cover pages as an ERT box. The rest (ToC, includes, etc.) could be made easily using LyX menus.
– FranOct 16 '15 at 5:52

Thank you for all the suggestions. After some tweaking/playing/learning, I managed to end up with a "sort of" hybrid between LyX and plain LaTeX. I have made a main .lyx file in which I've incorporated my thesis rules into a preamble and am including all the title pages (and so on) written directly in LaTaX (it seems much easier to accomplish what I want directly). But my plan is to write all the chapters in LyX since it seems easier to write equations and tables in it. Al least for now. Thanks again for all the help!
– tom555Oct 19 '15 at 8:39

btw, importing the .tex file directly in LyX didn't work, but calling tex2lyx from prompt worked, with all the mentioned warnings... Thanks for that as well!
– tom555Oct 19 '15 at 8:42

There's nothing really special about that TeX file, just a lot of junk. I'd start with an empty LyX document of the book class and set things to look as the template pdf when you add your own stuff. Then if something is missing just add the relevant code from the main file. I'm almost sure everything can be done without any code in TeX insets. Go through the code in main.tex and set the options you can find in LyX document settings. Sretno!
(Save the following code as a LyX file and use it as a template)