2

I am currently in article AMS document class. In LyX I'd like to enter my name and address in the following form:

enter image description here

Note that there's not a large gap between the author's name and the address. I would prefer not to include the address in the author section (since I am creating a 2-sided document whose headers alternate between a short title and the author).

In LyX I have two options that I am aware of:

  1. Use Address mode in Front Matter. The problem with this is that it includes the address at the end of the document.

  2. Enter it manually. I enter the address in standard mode then center it but there's still too much spacing between the author and the address (e.g., when I put .1 cm of vertical space, I get over an inch of space in the PDF).

How can I enter my address so that it appears as in the picture above AND does not part of Author? If I need to directly change the source code (i.e., editing the preamble, settings or entering an ERT), please include some detail on how I can go about that.

MWE

 \documentclass[oneside,english]{amsart}
 \usepackage[T1]{fontenc}
 \usepackage[latin9]{inputenc}
 \usepackage{amsthm}

 \makeatletter
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 \numberwithin{equation}{section}
 \numberwithin{figure}{section}

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
 \title[Short version]{Long version}
 \usepackage{mathtools}

 \makeatother

 \usepackage{babel}
 \begin{document}

 \title{{\small{Title}}}


 \author{Author\\
 }


 \address{Address }\maketitle

 \end{document}
  • Please consider adding a minimal example to all of your questions. See for example wiki.lyx.org/FAQ/MinimalExample. As for your question, I believe that behavior is determined by the class/style so you are asking for a way to override the default behavior. – scottkosty Nov 21 '15 at 19:22
  • 1
    Good point, I've edited. – The Substitute Nov 21 '15 at 19:29
2
+50

To have the ultimate control over where this content is displayed and whether/not it ends up elsewhere in the document, I would patch \@maketitle in the Document > Settings... > LaTeX Preamble using etoolbox:

\usepackage{etoolbox}

\patchcmd{\@maketitle}% <cmd>
  {\ifx\@empty\@dedicatory}% <search>
  {\smallskip
    \begin{center}
    \footnotesize% Size of the address content
    \begin{tabular}{c}
      Department of Who Cares \\
      University of Nowhere \\
      Randomville, RND
    \end{tabular}
  \end{center}
  \ifx\@empty\@dedicatory}% <replace>
  {}{}% <success><failure>

The above patch inserts the address just after setting the authors - \@setauthors - and just before the dedicatory - \@dedicatory. Note that some other packages may redefine \@maketitle. This patch works under the default definition of \@maketitle, which forms part of amsart.

enter image description here

enter image description here

  • When I copy and paste your message, I receive "LaTeX Error: Missing \begin{document}." If I insert \begin{document} after \usepackage{etoolbox} I am able to obtain the PDF, but the address doesn't appear. – The Substitute Nov 24 '15 at 18:20
  • @TheSubstitute: You may have to wrap the entire \patchcmd content within a \makeatletter ... \makeatother construction. See What do \makeatletter and \makeatother do? However, I've seen LyX automatically wrap the entire LaTeX Preamble within those. If this still doesn't fix the problem, could you post your .tex from LyX in Pastebin. – Werner Nov 24 '15 at 18:24
  • I included those codes at the end but still not showing up. What is .tex? Is that different from a MWE? – The Substitute Nov 24 '15 at 18:45
  • @TheSubstitute: The "Complete source" provided by LyX. You can also provide the .lyx source. Something that'll allow me to replicate your current problem. Otherwise it's difficult to fix. – Werner Nov 24 '15 at 18:46
  • 1
    @TheSubstitute: Okay, I see now. Remove \usepackage{babel} from the LaTeX Preamble, as it is already included elsewhere in your document settings. Then, use \makeatletter \patchcmd{..}{..}{..}{}{} \makeatother, since it seems like it didn't get included as expected. – Werner Nov 24 '15 at 20:27

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.