2

Lyx-2.2.0, article template and newbie in LyX and LaTeX.

Planning to use LyX for office needs, like reports, letters, code listings etc. So I need to customize (create new template, based on default) 'article' template to make document view I need.

Many things can be set via GUI of Lyx. But some - I can't find where to and how to...

The thing I need to change is: all space between items in all lists, between end of paragraph and beginning of new one has to be of equal line spacing. No matter of type of text is: regular text, paragraphs, listings, code, ...

How can I customize template?

1

You can define your own LyX Layout file and place it in /usr/share/lyx/layouts
(respectively %APPDATA%\LyX*\resources\layouts for windows)

Creating this file is a mixture of LaTeX definitions and LyX configuration options. Currently you only want to redefine some global variables, but maybe you want to add your own custom styles later!

Find more about creating layouts in the LyX wiki.

Don't forget to run "Re-configure LyX" from the menu after installing a new Layout file. Select your new layout afterwards in the Document Settings.

Here is an example of a simple extension of the standard article class/layout file.
example.layout:

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[article]{Your custom Layoutname}

Format 35

# important: include the default "article" layout, we want to extend it
Input article.layout

# global document settings in LaTeX preamble
Preamble
    % remove indentation for paragraphs ?
    % \setlength{\parindent}{0mm}

    % set spacing between paragraphs
    \setlength{\parskip}{8pt}

    % set spacing between items in lists
    \usepackage{enumitem}
    % play around with these parameters
    \setlist{topsep=5.2pt,parsep=8pt,partopsep=0pt,itemsep=0pt}    
EndPreamble

# Just in case you want to create a custom style:
Style My_Custom_Adress
    CopyStyle                Standard
    Align                    Left
    AlignPossible            Left
    # more M = more margin :-)
    LeftMargin               MMMMMMM
    ParSep                   1.2
    TopSep                   0.6
    BottomSep                0.6
    # we tell LyX that we use a custom LaTeX command
    LatexType                Command
    LatexName                myaddressindent
    Preamble
        % and define it in the LaTeX preamble for rendering
        \newcommand{\myaddressindent}[1]{
            {
                \leftskip3cm
                #1 \par
            }
        }
    EndPreamble
End
  • Thanks a lot for information. Later, I'll briefly read about Lyx layouts, try layout example you've posted and will post layout I need to (in case somebody will need the same) – Someone Jul 30 '16 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.