LaTeX forum ⇒ GeneralHelp to build a simple template

LaTeX specific issues not fitting into one of the other forums of this category.
otyugh
Posts: 3
Joined: Mon Jun 17, 2019 1:21 pm

Help to build a simple template

Postby otyugh » Mon Jun 17, 2019 1:47 pm

Hey,
I just finished my "simple template for french guys". There is one last thing I don"t get to do, is how to make a "conditionality" on a variable. Let review my actual template below.

%A4
\documentclass[10pt,a4paper]{article}

%french/europe
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[unicode=true]{hyperref}
\usepackage{eurosym}

%Wokaround (pandoc complains otherwise)
\def\tightlist{}

%images
\usepackage{graphicx}

%interligne plus ahéré
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}

\begin{document}
\begin{titlepage}
\centering
\rule{\textwidth}{.75pt}\vskip25pt
{\bfseries\Huge $title$}
\vfill
\includegraphics[width=8cm]{logo.png}
\vfill\vfill
{\normalsize $author$\vskip5pt}
PDF généré le \today\vskip5pt
\rule{\textwidth}{.75pt}
\end{titlepage}

$if(toc)$
{
\hypersetup{linkcolor=black}
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
%\pagebreak
}
$endif$

$body$
\end{document}


What I want to improve is the line "\includegraphics[width=8cm]{img/logo.png}" ; I'd want "img/logo.png" to be a variable loaded from the document, and if not set, or empty, or with a path leading to a non-existing file, to do an alternate thing instead of crashing.

Could you give me a pointer on to what I should do/where I should read ?

Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests