\date{} in the tabular environment!
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
\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.
You can put the following in the preambule
\usepackage{datetime}
\newdateformat{bkdate}{\THEYEAR-\shortmonthname-\twodigit{\THEDAY}}
and then print the date anywhere in the document body
\bkdate\today
精彩评论