The array
package gives the capability to replicate a declaration before every cell in a specifed column column. So if you have a column for a price, you can use a format like: {ll>{\$}r}
to put a dollar sign before every price.
Usually you want long dates in the text of a document (e.g. 5th August, 2021). Of course exceptionally you would usually want short dates in a table column. But this is broken:
\Begin{tabular}{l>{\DTMsetdatestyle{default}\DTMsetup{datesep=/}}rl}
col 1 && \DTMusedate{mydate} && col 3\\
\end{tabular}
The middle column still prints the long form of dates. It obviously clusterfucks the table to put the long-ass \DTMsetdatestyle{default}\DTMsetup{datesep=/}
in every middle cell.
The only workaround I can think of is to nest the whole table inside braces ({}
), and nest the date config with it:
{\DTMsetdatestyle{default}\DTMsetup{datesep=/}
\begin{tabular}{lrl}
col 1 && \DTMusedate{mydate} && col 3\\
\end{tabular}}
I’m calling it a bug because there is no good reason make code inside >{}
happen in a separate scope as the cell that preceeds.
That would work if dates are not reused. But if you have a block of
\DTMsavedate
variables in the preamble and then refer to those dates throughout the doc by the variable name you assign, the spreadsheet would be more trouble than it’s worth because you would have to copy-paste all the dates into the spreadsheet, choose the new format, copy them back, and risk the update anomaly in the event that you revise a date in the preamble. Could be useful for some situations though. But I guess I would still rather replicate\DTMsetdatestyle{default}\DTMsetup{datesep=/}
in every cell that needs it.