LyX[Preamble Variables]

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
NekoGaDaisuki
Posts: 1
Joined: Tue Feb 01, 2022 1:14 am

[Preamble Variables]

Post by NekoGaDaisuki »

Hello,
I am a candidate for a phd in computer science. During my master i've had to write a memoir. Because in my university Latex is overused compared to lyx that is almost never used nor known, i've written my memoir using lyx. The end result is a lyx master file with subdocuments.
In the master file, i needed to put some latex in the preamble of this file. Since a few teachers left latex templates, i used one of them and did the work on lyx to optimise the time.

Code: Select all

\usepackage{palatino}

\usepackage{amsfonts}\usepackage{multirow}
\usepackage{colortbl}\usepackage{xspace}
\usepackage{varioref}
\usepackage{xcolor}

\usepackage{graphicx}

\usepackage{appendix}

\newcommand{\version}[1]{\def\theversion{#1}}
\newcommand{\subtitle}[1]{\def\thesubtitle{#1}}

\newcommand{\authors}[1]{\def\theauthors{#1}\author{#1}}
\newcommand{\supervisor}[1]{\def\thesupervisor{#1}}
\newcommand{\tutor}[1]{\def\thetutor{#1}}

\newcommand{\authorname}{Author}
\newcommand{\authorsname}{Authors}
\newcommand{\supervisorname}{Supervisor}
\newcommand{\tutorname}{Tutor}

\newcommand{\thepartname}{Part}

\ifdefined\addto{%
\addto{\captionsfrench}{\renewcommand{\authorname}{Auteur}}%
\addto{\captionsfrench}{\renewcommand{\authorsname}{Auteurs}}%
\addto{\captionsfrench}{\renewcommand{\supervisorname}{Superviseur}}%
\addto{\captionsfrench}{\renewcommand{\tutorname}{Tuteur}}}
\addto{\captionsfrench}{\renewcommand{\thepartname}{Partie}}
\else{}
\fi

\pretitle{\flushleft\Huge\textsf}
\posttitle{\\[-.65em]\rule{\linewidth}{1.5mm}\\[-.65em]
\ifx\thesubtitle\undefined%
\else%
  \hfill{\small\itshape \thesubtitle}%
\fi
\centering
\vfill
\vfill
\iflanguage{french}{%
  {\Huge\bfseries Mémoire de fin d'études}
}{%
  {\Huge Master Thesis}
}\\
\vspace{1.25em}
\iflanguage{french}{%
  \LARGE
  Master \emph{Sciences et Technologies},\\
  Mention \emph{Informatique},\\
Parcours \emph{Génie Logiciel}.\\
  \par\hfill%
}{%
  \LARGE
  Master in \emph{Sciences and Technologies},\\
  Specialty in \emph{Computer Science},\\
Track \emph{Software Engineering}.\\
  \par\hfill
}}
%% author
\preauthor{\vspace{\fill}\\
\ifx\theauthors\undefined%
  \flushleft\textbf{\large\authorname}\\
\else%
  \flushleft\textbf{\large\authorsname}\\
\fi
\small}
\postauthor{\vspace{1em}
\ifx\thesupervisor\undefined%
\else%
  \newline\textbf{\large\supervisorname}\\\thesupervisor\\[1em]%
\fi
\ifx\thetutor\undefined%
\else%
  \textbf{\large\tutorname}\\\thetutor%
\fi
\\[-.25em]
\rule{\linewidth}{1mm}\\[-.25em]}
%% version and date
\predate{\hspace{\fill}
\ifx\theversion\undefined%
\else%
  version~\theversion~--~%
\fi}
\postdate{}

\chapterstyle{veelo}
%\chapterstyle{chappell}
%\chapterstyle{ell}
%\chapterstyle{ger}
%\chapterstyle{pedersen}
%\chapterstyle{verville}
%\chapterstyle{madsen}
%\chapterstyle{thatcher}

\renewcommand*{\thepart}{\arabic{part}}

\renewcommand*{\parttitlefont}{\chaptitlefont\Huge}
\renewcommand*{\partnamefont}{\chapnamefont\HUGE}
\renewcommand*{\partnumfont}{\chapnumfont\HUGE}

\renewcommand{\beforepartskip}{\vspace*{\fill}}
\renewcommand{\midpartskip}{\vspace{.5em}\hrule height 1.5mm \vspace{.5em}}
\renewcommand{\afterpartskip}{\vspace*{\fill}}

% table of contents
\renewcommand*{\cftpartname}{\thepartname}
\renewcommand*{\cftpartpresnum}{\space}
\renewcommand*{\cftpartaftersnum}{.}
\renewcommand*{\cftpartaftersnumb}{\space}

\cftpagenumbersoff{part}
\renewcommand{\cftpartafterpnum}{\protect\\[-.75em]%
  \protect\mbox{}\protect\hrule\par}

\renewcommand{\cftchapterdotsep}{4}

\newcommand{\latinloc}[1]{\ifx\undefined\lncs\relax\emph{#1}\else\textrm{#1}\fi\xspace}
\newcommand{\etc}{\latinloc{etc}}
\newcommand{\eg}{\latinloc{e.g.}}
\newcommand{\ie}{\latinloc{i.e.}}
\newcommand{\st}{\ensuremath{\text{\xspace s.t.\xspace}}}

\title{title goes there}
\subtitle{subtitle goes there}

\author{authorname \texttt{<author email>}}

\supervisor{supervisor name \texttt{<supervisor email>}}

\tutor{tutor name \texttt{<tutor email>}}
Is there any way to define variables such as author, supervisor and tutor outside of the preamble and directly in the "document" ?

Recommended reading 2024:

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

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

Post Reply