On 01-Apr-19 9:58 PM, Paul Johnson wrote:
I have a dissertation template for students at my University. There is a main 
thesis document and then the separate chapters are in subdirectories. 
(http://crmda.ku.edu/node/555)

Currently, in version, 
"KU-thesis-20190201.zip<http://crmda.dept.ku.edu/guides/43.KU_Thesis/KU-thesis-20190201.zip>",
 it appears to work for everybody to use LyX to edit either the main document 
or the individual chapters.

However, I have students who want to use the dissertation template as raw 
LaTexX files, rather than within LyX.  Here I run into a bad problem.

In my 20190201 version, the people who want to edit the exported LaTeX file in 
raw LaTeX could not compile the document.  There's an error about commands in 
the chapter heading that are only allowed in the document preamble.  From that 
error message, I tracked back to changes I made and I understand what is going 
wrong.

If I start with the master document and do Export to LaTeX (pdflatex), the 
individual chapter .tex files are created.  They are not free-standing 
documents. At the top, there was no preamble. It starts in line 1 with the 
chapter name

\chapter{Elementary Regression}

and also the includegraphics lines have full project paths:

\includegraphics[width=4in]{Chapter2/importfigs/carinced}

Those chapters could not be compiled individually.

I thought I'd get around this problem by using LyX to individually exporting 
each separate chapter as a tex document. I did not realize that caused an 
entirely different export than I got by starting with the master document in 
LyX and doing export LaTeX(pdflatex).

My individually exported chapter files allows the users to edit the individual 
.tex chapters, but when they try to compile the master document, they get 
errors caused by the fact that the individual chapters have their own preambles 
AND the graphics paths are incorrect.

Because I individually exported the .tex files within the Chapter directories, 
then the master document level Export to LaTeX does not replace the existing 
chapters.  Thus I am allowed to zip up the directory and have a master document 
that does not compile because the child documents have preambles in them.

Now that I understand the problem, I wonder if other people have noticed this 
and if they have suggestions for a fix?

I wondered if perhaps we might have the necessary preamble created as a 
separate file in each chapter with some if/then magic in each chapter preamble 
to specify whether or not the master file is in control.

Some fix about the figure paths is necessary as well, I don't have a guess 
about that.

pj

--
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu<http://ku.edu>.

Hello,

I have recently developed a LyX template of our university graduate thesis from 
the LaTeX template (https://github.com/ituast/itutezLyX). I have checked the 
zip file you gave the link, and I can tell that the structure of the LyX files 
is very similar to what I did. I have encountered similar problems. We can find 
(or develop) solutions or procedures for these problems.

Including a LyX file within a master LyX file is different than including a 
LaTeX file within a master LaTeX file. Because in LyX, you can specify which 
preamble is to be used through the document settings. For LaTeX, there is no 
such thing, as it is a lower-level process of management/compilation, where the 
user has to handle everything.

As you have mentioned, when you export a LyX file to a LaTeX file, LyX always 
puts a preamble, which is smtg that you you may not want if the resulting LaTeX 
file is to be included in a master LaTeX file. The exporter may have an option 
to ignore the preamble. If you want to implement it, you may need to go the 
executable of the exporter and search through the command-line help using a 
help flag (--help, --? or smtg like that). On the other hand, you may still 
want to have a working preamble to be able to compile the individual LaTeX file 
to see the result immediately, before inserting it back to the LyX file. The 
problem with that is thesis class file may have a complicated structure, where 
you should have all major parts together, otherwise, an individual child file 
will not compile. So, in this case, it may be a good idea to compile it as a 
complete thesis, but to include the interested chapter only, which will make 
the compilation faster.

So the problem to me is very specific and isolated. In my case, what I did, I 
developed a unique procedure and tested it for each of this type of student 
request. Then asked the students to follow that unique procedure. In your case, 
we need to define clearly what exactly the students want to do. According to 
you mail, what I understood is this: The students want to be able to work on 
the child LyX files, by modifying the LaTeX code and would like to compile the 
child document only, rather than complete thesis, and they want to to do the 
compilation through the LaTeX system rather than the LyX system. Of course, at 
some point they would want to import the LaTeX file back into the LyX system, 
am I right?

Now, if this is what they want to do, I would first develop a LaTeX system, 
where you can compile complete thesis and where all chapters are seperate 
to-be-included LaTeX files and are included in the main file. We can ask LyX to 
export a chapter  to a LaTex file and then clean the preamble. The main LaTeX 
file can be used to compile as if the whole thesis is being compiled, where 
only the individual chapter is included. After the work is completed in the 
LaTeX domain, a temporay preamble can be added to it for the purpose of 
importing it into LyX. The LaTeX file can be imported to LyX using the tex2LyX 
converter with additional command line options. Importing through default LyX 
may not always result a useful LyX file (you can add your specific converter 
with the desired parameters into the LyX AFAIK, because LyX is very 
customizable). After having a rough LyX file (which may have the wrong 
preamble), the contents can be copy/pasted to the original LyX child document.

I hope this gives you some idea. I am not sure if there can be a more direct 
approach since the problem is very specific and I am not too familiar with the 
hidden powers of LyX.

Baris




--
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
Please bottom-post. Start your reply here:

Reply via email to