On Wednesday 29 August 2007 09:41:50 you wrote:
> > AFAIKS an easy solution is to move the the title and author after the
> > \begin{document} in the original tex file.
>
> Humm... I guess that defeats the point of the procedure, since instead
> of having an automatic conversion I need to manipulate the text file.
> Then I might as well re-write the title and author in LyX...

  I was talking about a patch to txt2tags. BTW since it is done in python and 
it was so easy it follows attached.

> Is the tex format produced by txt2tags somehow unhortodox? Should I
> annoy its developers about this in their mailing list?
>
> > What we could do in tex2lyx is to output the \maketitle in ERT if there
> > no other title elements, while now we delete it unconditionally.
> >
> > What do others think?
>
> No comments?

  The patch to tex2lyx follows attached.
  No one is loosing the sleep over this misfeature. ;-)

> Cheers
>
> Alex

OK, now you have two patches to choose. Either you patch tex2lyx or txt2tags, 
it is your choice. :-)

-- 
José Abílio
Index: src/tex2lyx/text.cpp
===================================================================
--- src/tex2lyx/text.cpp	(revision 19918)
+++ src/tex2lyx/text.cpp	(working copy)
@@ -1107,6 +1107,7 @@
 	LayoutPtr newlayout;
 	// Store the latest bibliographystyle (needed for bibtex inset)
 	string bibliographystyle;
+	bool has_title_layout = false;
 	bool const use_natbib = used_packages.find("natbib") != used_packages.end();
 	bool const use_jurabib = used_packages.find("jurabib") != used_packages.end();
 	while (p.good()) {
@@ -1116,6 +1117,10 @@
 		cerr << "t: " << t << " flags: " << flags << "\n";
 #endif
 
+		if (context.layout->intitle) {
+			has_title_layout = true;
+		}
+
 		if (flags & FLAG_ITEM) {
 			if (t.cat() == catSpace)
 				continue;
@@ -1710,6 +1715,9 @@
 		else if (t.cs() == "makeindex" || t.cs() == "maketitle") {
 			// FIXME: Somehow prevent title layouts if
 			// "maketitle" was not found
+			if(t.cs() == "maketitle" && !has_title_layout) {
+				handle_ert(os, "\\maketitle", context);
+		}
 			p.skip_spaces();
 			skip_braces(p); // swallow this
 		}
--- txt2tags~	2006-12-22 01:19:32.000000000 +0000
+++ txt2tags	2007-08-30 22:35:02.000000000 +0100
@@ -434,9 +434,9 @@
 \usepackage[%(ENCODING)s]{inputenc}  %% char encoding
 \usepackage{%(STYLE)s}  %% user defined
 
+\begin{document}
 \title{%(HEADER1)s}
 \author{%(HEADER2)s}
-\begin{document}
 \date{%(HEADER3)s}
 \maketitle
 \clearpage

Reply via email to