2

I would like to create a Subtitle environment that will be available in the Environments dropdown while using memoir. I've tried editing stdtitle.inc, memoir.layout, and creating a subtitle.module

This is what I am trying to define... same as "title" but one size down.

Style Subtitle
    Margin                Static
    LatexType             Command
    Category              FrontMatter
    InTitle               1
    LatexName             subtitle
    ParSkip               0.4
    ItemSep               0
    TopSep                0
    BottomSep             1
    ParSep                1
    Align                 Center
    LabelType             No_Label
    Font
      Size                Larger
    EndFont
End

Editing stdtitle.inc or memoir.layout, I do see "subtitle" in my drop menu, but on export I get the error below:

The control sequence at the end of the top line
of your error message was never \def'ed.

In the custom module, I get an error saying the module "subtitle" requires packages, and is missing the prerequisite "subtitle"

How do I define subtitle so 1) I can access it in the dropdown, 2) it's understood by Lyx, and 3) exports correctly?

  • What is the full LaTeX code that you want to produce in the end? – scottkosty Feb 6 '18 at 1:00
  • Hi, Scott. I'm going for the following: \begin{document} \title{ Title of Novel } \subtitle (Subtitle of Novel} \author{author of book} \end{document} – Kitty Feb 7 '18 at 1:34
  • If you post a complete minimal example .lyx file (see wiki.lyx.org/FAQ/MinimalExample), the .tex file that that .lyx file produces, and the complete .tex file that you would like to produce, I can take a look. – scottkosty Feb 7 '18 at 2:51
2

Your problem is that memoir doesn't provide a \subtitle macro by default, so when you use that layout on LyX, which ends up using the LaTeX code \subtitle{...}, you get an error.

To get your code to work, you can use the code from egreg's answer to Subtitle with the \maketitle page?. While that is written for the article class with the titling package, memoir includes code equivalent to titling, so the same code seemed to work fine also with memoir.

Hence, use the layout you have created already, and then add

\newcommand{\subtitle}[1]{%
  \posttitle{%
    \par\end{center}
    \begin{center}\large#1\end{center}
    \vskip0.5em}%
}

to the preamble, either in Document -> Settings -> LaTeX preamble or in the .module file itself. (I don't remember how to add stuff to the preamble in a module though.)

Complete .lyx file:

enter image description here

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass memoir
\begin_preamble
\newcommand{\subtitle}[1]{%
  \posttitle{%
    \par\end{center}
    \begin{center}\large#1\end{center}
    \vskip0.5em}%
}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\begin_local_layout
Style Subtitle
    Margin                Static
    LatexType             Command
    Category              FrontMatter
    InTitle               1
    LatexName             subtitle
    ParSkip               0.4
    ItemSep               0
    TopSep                0
    BottomSep             1
    ParSep                1
    Align                 Center
    LabelType             No_Label
    Font
      Size                Larger
    EndFont
End
\end_local_layout
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Title
This
\end_layout

\begin_layout Subtitle
That
\end_layout

\begin_layout Author
Foo
\end_layout

\end_body
\end_document

protected by Community Apr 19 at 14:08

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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