Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

\date{} in the tabular environment!

Tags:

latex

I would like to make a table using the tabular environment, and in one of the cells in my table I need to include the actual date. A clever approach would then be using the \date{} command - but I cannot make it work to include the \date{} command inside the tabular environment...is that not possible??

Cheers,

Karsten

like image 688
Karsten Lentfer Avatar asked Feb 08 '11 12:02

Karsten Lentfer


1 Answers

\date doesn't get the date, it sets the date of the document. If you browse the latex.ltx source code you find:

\def\date#1{\gdef\@date{#1}}

So if the date of the document is set in the preamble, you can get it by using \@date. Unfortunately (for you) that macro has an @ in it so you can't use it directly in regular document text. So you would have to put this in your preamble:

\makeatletter
\let\insertdate\@date
\makeatother

Then \insertdate is an alias to \@date and will insert the date specified in the preamble into the current text.

But you also mentioned the "actual" date, which may mean the current date as of the compilation of the document. That information is stored by TeX in \today.

BTW, You can find an entire community on the TeX StackExchange, where no TeX-related question is too small.

like image 141
Matthew Leingang Avatar answered Sep 30 '22 14:09

Matthew Leingang