LyXAutoadding \maketitle destroys layout of my article

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
nuke
Posts: 6
Joined: Tue Jul 14, 2009 4:01 pm

Autoadding \maketitle destroys layout of my article

Post by nuke »

...Apparently, it is possible to compile elsarticle doc correctly with either frontmatter or maketitle, but not with both of them. After removing frontmatter, it works perfectly.
At the present I am writing a journal article to be submitted to a journal of Elsevier publishing company. I am supposed to use a special class (elsarticle.cls) based on article.cls. However, my document does't look good after LyX compilation to dvi/ps/pdf. I have found that LyX adds two lines which ruin the layout:

Code: Select all

...
\maketitle
...
\addcontentsline{toc}{section}{\refname}
...
As a result I have two title pages, wrong authors names footnoting, no bibliography... :( So in order to get a correct document I have to export to latex, correct the text and compile it using another latex editor. :|

Does anyone know how to set LyX to do not put these lines? Or any other way how to solve the problem?
Thanks
Last edited by nuke on Wed Jul 15, 2009 7:04 pm, edited 2 times 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.

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: Autoadding \maketitle destroys layout of my article

Post by kaiserkarl13 »

I don't use LyX much, but my version (1.4.5.1) doesn't seem to put a \maketitle command in the exported file. You might check the document settings to make sure you didn't accidentally put it in there. Also make sure the document class is set to article (elsart) instead of article (standard) or whatever that one is called.
nuke
Posts: 6
Joined: Tue Jul 14, 2009 4:01 pm

Autoadding \maketitle destroys layout of my article

Post by nuke »

kaiserkarl13 wrote:I don't use LyX much, but my version (1.4.5.1) doesn't seem to put a \maketitle command in the exported file. You might check the document settings to make sure you didn't accidentally put it in there. Also make sure the document class is set to article (elsart) instead of article (standard) or whatever that one is called.
My LyX is 1.6.3 and the document class is definitely correct. LyX adds
\makeatletter and \makeatother as well, but they seem to be harmless.
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: Autoadding \maketitle destroys layout of my article

Post by kaiserkarl13 »

I think I figured out one problem: old versions of LyX come with the elsart (not elsarticle) template. elsart.cls was written by itself about ten years ago, whereas elsarticle.cls was written about a year ago, based on the article class.

You therefore need the \maketitle command to get the title, abstract, etc. in elsarticle.cls (i.e., it's supposed to be there), but not with elsart.cls (which is what LyX 1.4 used).

Using LyX 1.6.2, I am unable to reproduce your problem---the layout looks exactly the same (sans the title, authors, and abstract, which is expected) with and without the \maketitle command. The \addcontentsline command shouldn't do anything if you don't have a table of contents; are you sure that's the problem? I'd need a more thorough description of what's happening (i.e., what is "bad" about the layout) to diagnose further.

Good luck!
nuke
Posts: 6
Joined: Tue Jul 14, 2009 4:01 pm

Autoadding \maketitle destroys layout of my article

Post by nuke »

Bingo! I have found the reason!
However, it is not connected with the class (I am using elarticle.cls all the time).

It is my first experience with LaTeX, so I have started to write my article using an article of my colleague as an example, like the most of beginners do. There were commands \begin{frontmatter} and \end{frontmatter} in that example. Everything was fine and I have compiled my article successfully using several editors (LEd, WinEdt etc). After a while I was suggested to try LyX, and after importing my latex doc, the operators remained in LyX document as tex code. I thought that they are required, so I didn't touch them. But now having the problem I has started to remove from my doc everything which I don't fully understand...

Apparently, it is possible to compile elsarticle doc correctly with either frontmatter or maketitle, but not with both of them. After removing frontmatter, it works perfectly.

Thank you for your help and time, kaiserkarl13!
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Autoadding \maketitle destroys layout of my article

Post by kaiserkarl13 »

Thank you for your help and time, kaiserkarl13!
You are welcome.
yoderj
Posts: 1
Joined: Sat Apr 07, 2012 1:16 am

Autoadding \maketitle destroys layout of my article

Post by yoderj »

I'm posting this here because it shows up as the first hit for "LyX maketitle."

If you want commands to be run before \maketitle, you can set the "InTitle 1" option in the .layout file. For example, to postpone \makefile until after the abstract, edit the .layout file:

Code: Select all

Style Abstract
   InTitle 1
End
To postpone \makefile until after your custom commmand "affils," you can add a new "Affils" style in the .layout file:

Code: Select all

Style Affils
	LatexType             Command
	LatexName             affils
	LabelSep              x
	Align                 Center
	LabelType             Static
	LabelFont
	  Series              Bold
	  Color               Blue
	EndFont
	LabelString "Affils:" 
InTitle 1
End
More detail on the options available here are available in LyX from Menu: Help->Customization.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Re: Autoadding \maketitle destroys layout of my article

Post by Stefan Kottwitz »

Hi yoderj,

welcome to the board!

Seems now a LyX expert visited the forum! :)
If you see more unsolved problems in the LyX forum, feel free to answer if you know a solution, even if a question would be a bit older - for later readers. Just if you like, that would be great.

Best regards,

Stefan
LaTeX.org admin
essam002002
Posts: 1
Joined: Fri Jan 15, 2016 2:09 am

Re: Autoadding \maketitle destroys layout of my article

Post by essam002002 »

This solution works for me:
1- After author names add "standard in title" from the menu
2- Press Ctrl+L and insert the following code "\IEEEtitleabstractindextext{\begin{abstract} YOUR ABSTRACT GOES HERE \end{abstract}}"
Post Reply