LyXWhere/How to enter latex code into lyx

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Where/How to enter latex code into lyx

Post by insipidtoast »

Where/how does one enter latex code to modify the lyx document they are working on?

As a beginner, I suspect there are at least a couple different places to enter code, probably depending on whether you want to change something just once, or if you want that something to always be changed.???

Some examples:
1) You want to change only one paragraph so that the first line is indented.
2) You want every paragraph to be indented throughout the whole document.

If this question has already been answered, please post some links.

Thanks
Last edited by insipidtoast on Fri Jul 06, 2012 5:20 pm, edited 1 time in total.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Where/How to enter latex code into lyx

Post by localghost »

What does the LyX Wiki say?


Thorsten
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Where/How to enter latex code into lyx

Post by insipidtoast »

Where does the lyx wiki say?
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
User avatar
Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Where/How to enter latex code into lyx

Post by Stefan Kottwitz »

The best way is using LaTeX in the document preamble, making global definitions. In the menu, choose Documents, then Settings, there you can find the document preamble. There you can insert \usepackage commands for loading packages with settings and making further definitions.

If you repeat LaTeX commands within the text, there's a good chance that you could do the same by a global setting, in the preamble.

In case you would like to use LaTeX just locally and once, you could insert TeX code in the document: click the TeX toolbar button, or select Insert and TeX. This is also known as ERT.

Stefan
LaTeX.org admin
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Where/How to enter latex code into lyx

Post by insipidtoast »

In my version of Lyx what you are calling "document preamble" is called "LaTeX Preamble."
Stefan_K wrote:The best way is using LaTeX in the document preamble, making global definitions. In the menu, choose Documents, then Settings, there you can find the document preamble. There you can insert \usepackage commands for loading packages with settings and making further definitions.
So that's the area to make changes that apply to the whole lyx document?
Stefan_K wrote:In case you would like to use LaTeX just locally and once, you could insert TeX code in the document: click the TeX toolbar button, or select Insert and TeX. This is also known as ERT.
And that's how you make a one-time-only change?

Thanks

I'm currently reading the Not So Short Introduction to Latex2e. Please let me know if you think there's a better tutorial that's more geared towards my desire of customizing a few thing here and there within lyx, and making a couple "global definitions."
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
User avatar
Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Where/How to enter latex code into lyx

Post by Stefan Kottwitz »

insipidtoast wrote:In my version of Lyx what you are calling "document preamble" is called "LaTeX Preamble."
I don't have LyX installed on the computer where I'm currently working. So take the advice as a guide, not as "click exactly there".
insipidtoast wrote:So that's the area to make changes that apply to the whole lyx document?
Yes.

Regaredig ERT within the document:
insipidtoast wrote:And that's how you make a one-time-only change?
Yes. But a change, such as a "declaration", has effect from the place where it has been made onwards, until the current scope has ended. Scopes can be limited by curly braces, and also LaTeX environments are limiting a scope. For example:
  • If you place a command within a table, it ends when the table ends.
  • If you would like to have an effect in a small specific region, you could use braces, such as {\bfseries bold text here} normal text continues
  • A simply inserted command can have effect until the document ended - if you don't insert a command which cancels it. (such as \normalfont after font changes).
For knowing such things it's good to read the l2short document.

Stefan
LaTeX.org admin
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Where/How to enter latex code into lyx

Post by insipidtoast »

Stefan_K wrote:For knowing such things it's good to read the l2short document.
l2short document?

Where is that? I didn't see it in your resources for beginners post.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
User avatar
Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Re: Where/How to enter latex code into lyx

Post by Stefan Kottwitz »

lshort is the correct name, it's a common shortcut for the document which you already mentioned, The Not So Short Introduction to Latex2e, and its filename.

Stefan
LaTeX.org admin
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Re: Where/How to enter latex code into lyx

Post by insipidtoast »

Great!

Thank you sir.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
Post Reply