0

I have a 30 page apartment lease that I have to fill out with tenants every year. In this lease there are several spaces which I have to go to and enter text such as name of tenant, date, apartment, rent amount, security deposit, move in, move out, etc.. I spend most of my time proof reading and I always worry I am forgetting to edit some section.

My question is this, at beginning of the latex code can I have a section that looks like this:

  1. Landlord name
  2. Tenant name
  3. Rent price
  4. Security deposit price
  5. Guarantor
  6. Move in
  7. Move out

and then once I fill in each line, it would input that result in a certain place in the 30 page document where it is needed. So I would never have to go through the whole document again but just rely on filling in the code at the beginning and knowing it will fill it in automatically. I would proofread it of course.

Thanks for the help

Mike S
  • 1
  • Welcome to TeX.SX! You could define your own commands in the rpeamble, for example using \newcommand{\tenant}{<your tenants name>}. You can then use \tenant inside of your document's text wherever you want the tenants name to appear. In order to change the name throughout the document, just change the definition in the preamble and recompile. – leandriis Jun 05 '21 at 08:34
  • Please consider to accept/upvote the answer when it was helpful. This way, the process is finished. – Dr. Manuel Kuehner Jun 06 '21 at 06:17

1 Answers1

1
  • Building on leandriis' comment.
  • Here is a proof-of-concept.
  • I added the xspace package for more convenience, details see here.
  • In addition, I added the xcolor package as eye candy :).

\documentclass{article}

\usepackage{xspace} \usepackage{xcolor}

% Define Variables \newcommand{\myTenant}{\textcolor{blue}{John Doe}\xspace} \newcommand{\myRentPrice}{\textcolor{blue}{500~USD}\xspace} \newcommand{\myMoveInDate}{\textcolor{blue}{2021-01-01}\xspace} \newcommand{\myMoveOutDate}{\textcolor{blue}{2022-12-31}\xspace}

\begin{document}

The tenant \myTenant will pay a monthly rent of \myRentPrice. The move-in date (YYYY-MM-DD) is \myMoveInDate and the move-out date is \myMoveOutDate.

\end{document}

enter image description here


Here a more structured proposal.

\documentclass{article}

\usepackage{xspace} \usepackage{xcolor}

%% Define Variables % Formatting Command To Avoid Repeating Code \newcommand{\myVariableFormat}[1]{\textcolor{blue}{#1}\xspace}

% Actual Variables \newcommand{\myTenant}{\myVariableFormat{John Doe}} \newcommand{\myRentPrice}{\myVariableFormat{500~USD}} \newcommand{\myMoveInDate}{\myVariableFormat{2021-01-01}} \newcommand{\myMoveOutDate}{\myVariableFormat{2022-12-3}}

\begin{document}

The tenant \myTenant will pay a monthly rent of \myRentPrice. The move-in date (YYYY-MM-DD) is \myMoveInDate and the move-out date is \myMoveOutDate.

\end{document}

  • That is exactly what I was looking for. Thank you for the help. – Mike S Jun 06 '21 at 04:20
  • 1
    +1. Although the author of xspace doesn't really like it: https://tex.stackexchange.com/a/86620/107497. The problem is that it's possible for xspace to fail, so you still need to proofread your text, which defeats the entire point of using xspace. – Teepeemm Jul 06 '21 at 03:04
  • @Teepeemm Thanks for the comment! I assume that David is overly perfectionistic and therefore never happy/satisfied :). – Dr. Manuel Kuehner Jul 06 '21 at 03:27