6

I need to use a tabular with a @ inter-column specification within a \makeatletter and \makeatother environment. I. e. I something like

\makeatletter
%code that uses @ as letter
\begin{tabular}{c@{}c}
%code that uses @ as letter
\end{tabular}
%more code that uses @ as letter
\makeatother

Is there any alternative to the @-character in the tabular definition. For example the \\ sequence can be substituted by \tabularnewline if necessary. Is there something similar for the @. And as I am already asking, does an alternative for & (in tabulars) exists, too?

Amendment from 21.06.2014:

I found a working solution myself. This is my code now:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myarticle}[2014/06/18 My article]

\ProcessOptions\relax

\LoadClass[paper=a4,fontsize=10pt,ngerman,hyperref,draft]{scrartcl}

\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage{textcomp} % required to get special symbols
\RequirePackage[utf8]{inputenc}
\RequirePackage[final]{microtype}
\RequirePackage{babel}
\RequirePackage[final]{graphicx}
\RequirePackage{booktabs}

\makeatletter

\def\@maketitle{%
\newpage\null\noindent%
\setlength{\tabcolsep}{0pt}%
\begin{tabular}[t]{lr}%
\begin{minipage}[t]{.75\textwidth}%
\sffamily
\Huge\@title\par%
\vskip.5ex%
\Large\@date\par%
\end{minipage}%
&%
\begin{minipage}[t]{.25\textwidth}%
\raggedleft\footnotesize
\includegraphics[width=\textwidth]{logo.pdf}\par%
\vskip.5\baselineskip%
Company Name\par%
\vskip.5\baselineskip%
Street and Number\par%
Postal code and Town\par%
\end{minipage}%
\end{tabular}%
\par
}

\makeatother

Originally, I did not have the line

\setlength{\tabcolsep}{0pt}

but tried

\begin{tabular}[t]{l@{}r}%

instead to supress the inter-column spacing. The latter results into non-compiling code. So my guess was that the @ notation interferes with the \makeatletter command.

  • It would have been helpful to have provided an example making an error. If you think there was a problem to which this is the solution please don't put the solution in the question put it as an answer and accept it. – David Carlisle Jun 21 '14 at 10:21
  • I would not call it a solution but rather a work-around. As I wrote I wanted to use @{} to suppress the inter-column spacing. That did not work. Hence, I use \setlength{\tabcolsep}{0pt} now instead. In this particular situtation this is fine. But if one wanted to use @{foo} for anything else, e.g. to insert a vertical line between the columns, the @-notation still fails. Hence, the original question is still open. – nagmat84 Jun 22 '14 at 11:13
  • Please make a minimal example that shows the problem. "fais" is not at all informative, gives wrong output or gives error or ... – David Carlisle Jun 22 '14 at 11:42
7

The test for @ is not sensitive to catcode so you do not need to do anything (but you shouldn't really need to use \makeatletter mid document).

For & you can use \let\tabsep=& in the preamble and use \tabsep instead of &.

  • Thanks, but I would not ask if @ was working.Why do you believe I use \makeatletter in the middle of the document? I didn't write that, did I? I am writing a *.cls file based on scrartcl and I need to redefine \maketitle, hence I need to access \@title, \@date and so on. I need the tabular to layout the title. – nagmat84 Jun 19 '14 at 18:11
  • @user2690527 something may not be working and your tabular may be on the class file not mid document (in which case your question is misleading as there is presumably no \makeatletter in the class file) but as you did not provide any example code people have to guess. If if isn't working it isn't because of an interaction of \makeatletter and the tabular @ construct. – David Carlisle Jun 19 '14 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.