I am not sure this is possible nor how I can accomplish this and thus I can't include a MWE. I assume though that stuff like this is used to create LaTeX packages.
The idea is to add a table row (or any text for that matter) only if the user has defined a variable. Something like this:
% as part of a different file, say some sort of class I'm defining \newcommand\address[1]{\def\theaddress{#1}} \address{\theaddress{}} % I guess this defines an empty definition? % later on the same document, inside a table (this is pseudo-code) if \theaddress is not empty, write { Address & \theaddress \\ } else don't add anything % later on the actual document I can define the address to whatever I want. \address{This is my address} UPDATED
So I came up with this working example. Say you have the user document as:
\documentclass[]{project} \contact{\footnotesize{John Doe}} \contactb{\footnotesize{John Appleseed}} \address{\footnotesize{PME}} \addressb{\footnotesize{BME}} \phone{\footnotesize{...}} \phoneb{\footnotesize{...}} \email{email1} \emailb{email2} % Reference top left \begin{document} \makeheader \end{document} And a project.cls as follows:
\NeedsTeXFormat{LaTeX2e} \ProvidesClass{tuletter} \LoadClass[a4paper,10pt]{article} \RequirePackage[absolute]{textpos} % positioning the header elements \RequirePackage[usenames,dvipsnames]{color} % use gray color for default values and labels % Font color for default values (values not defined in LaTeX file) \newcommand{\tudefault}[1]{\textcolor{Gray}{#1}} \newcommand\contact[1]{\def\tucontact{#1}} \contact{\tudefault{contact name}} \newcommand\contactb[1]{\def\tucontactb{#1}} \contactb{\tudefault{contact name 2}} \newcommand\address[1]{\def\tuaddress{#1}} \address{\tuaddress{your address}} \newcommand\addressb[1]{\def\tuaddressb{#1}} \addressb{\tuaddressb{second line of your address}} \newcommand\phone[1]{\def\tuphone{#1}} \phone{\tudefault{+31 (0)15 278 \ldots}} \newcommand\phoneb[1]{\def\tuphoneb{#1}} \phoneb{\tudefault{+31 (0)15 278 \ldots}} \newcommand\email[1]{\def\tuemail{#1}} \email{\tudefault{\ldots @tudelft.nl}} \newcommand\emailb[1]{\def\tuemailb{#1}} \emailb{\tudefault{\ldots @tudelft.nl}} %%% Labels \newcommand{\turefval}[1]{\small{#1}} \newcommand{\tureflab}[1]{\textcolor{Gray}{\scriptsize{#1}}} \newcommand\tudatename{Date} \newcommand\tucontactname{Contact} \newcommand\tuaddressname{Your address} \newcommand\tuphonename{Phone} \newcommand\tuemailname{E-mail} \newcommand{\makeheader}{% \textblockorigin{0cm}{0cm} % Reference \begin{textblock*}{100mm}(25mm, 9mm) \begin{tabular}{r@{ }cc} \tureflab{\tucontactname} & \turefval{\tucontact} & \turefval{\tucontactb} \\ \tureflab{\tuaddressname} & \turefval{\tuaddress} & \turefval{\tuaddressb} \\ % & \turefval{\tuaddresss} & \turefval{\tuaddressbs} \\ \tureflab{\tuphonename} & \turefval{\tuphone} & \turefval{\tuphoneb}\\ \tureflab{\tuemailname} & \turefval{\tuemail} & \turefval{\tuemailb} \\ % \tureflab{\tusubjectname} & \turefval{\tusubject} \\ \end{tabular} \end{textblock*} } \endinput which I stripped from a working template. The result of this code is:
But now everything is hardcoded so that 2 people show up at the top. My idea is to extend this code so that it works with only 1 or even more people, while keeping the same format AND allow the inclusion of more information per field (for example, if the address needs to take more space so that it fits within 2 or more lines).


\documentclassat the top and\begin{document} \end{document}around a sketch of the code that set\addressand used\theaddress(presumably) in the middle of atabularenvironment. Then reported the error and ask that people ammend it so the error goes away.