6

I have in my generated LaTeX Document

\newfont{\cmsi} {cmssqi10}

Then I have a first \newcommand which does not work

\newcommand{\°}{& \cmsi}

And I have a second command which works fine.

\newcommand{\0}{& \cmss}

If I change the by a \1 all works fine. BUT ...
The issue is that I would like to keep the as I do not like to change this in a larger porting project in DB's, DOKs (HeaderFiles) and CODE (LegacyCode) where the "°" is also used as separator sometimes.

If I replace the by a \1 all works fine and PDF is generated later.

! Misplaced alignment tab character &.
<argument> &
             \cmsi 
l.20 \newcommand{\°}{& \cmsi}

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9) entering
extended mode (DO_00012580_PA1_20151231.4.DOK LaTeX2e <2015/10/01>
patch level 2 Babel <3.9n> and hyphenation patterns for 69 languages
loaded. (E:\MiKTeXportable\tex\latex\base\article.cls Document Class:
article 2014/09/29 v1.4h Standard LaTeX document class
(E:\MiKTeXportable\tex\latex\base\size10.clo))
(E:\MiKTeXportable\tex\generic\german\german.sty v2.5e 1998-07-08)
(E:\MiKTeXportable\tex\latex\graphics\graphicx.sty
(E:\MiKTeXportable\tex\latex\graphics\keyval.sty)
(E:\MiKTeXportable\tex\latex\graphics\graphics.sty
(E:\MiKTeXportable\tex\latex\graphics\trig.sty)
(E:\MiKTeXportable\tex\latex\00miktex\graphics.cfg)
(E:\MiKTeXportable\tex\latex\graphics-def\pdftex.def
(E:\MiKTeXportable\tex\generic\oberdiek\infwarerr.sty)
(E:\MiKTeXportable\tex\generic\oberdiek\ltxcmds.sty))))
(DO_00012580_PA1_20151231.4.aux)
(E:\MiKTeXportable\tex\context\base\supp-pdf.mkii [Loading MPS to PDF
converter (version 2006.09.02).] )
(E:\MiKTeXportable\tex\generic\oberdiek\pdftexcmds.sty
(E:\MiKTeXportable\tex\generic\oberdiek\ifluatex.sty)
(E:\MiKTeXportable\tex\generic\oberdiek\ifpdf.sty))
(E:\MiKTeXportable\tex\latex\oberdiek\epstopdf-base.sty
(E:\MiKTeXportable\tex\latex\oberdiek\grfext.sty
(E:\MiKTeXportable\tex\generic\oberdiek\kvdefinekeys.sty))
(E:\MiKTeXportable\tex\latex\oberdiek\kvoptions.sty
(E:\MiKTeXportable\tex\generic\oberdiek\kvsetkeys.sty
(E:\MiKTeXportable\tex\generic\oberdiek\etexcmds.sty)))) ! Misplaced
alignment tab character &. <argument> &
             \cmsi  l.20 \newcommand{\°}{& \cmsi}
                               ?

AND THAT IS CREATING OUTPUT in PDF note: I changed only from \° to \1

\documentclass{article}
\usepackage{german}
\usepackage{graphicx} 
\pagestyle{empty}
\topmargin=-22.0mm
\evensidemargin=-25.4mm
\oddsidemargin=-25.4mm
\textwidth=20.5cm
\textheight=28.0cm
\hoffset=0mm
\voffset=0mm

\begin{document}

\newfont{\cmf}{cmssqi8}
\newfont{\cmsi}{cmssqi10}
\newfont{\cssi}{cmssqi12}
\newfont{\cmss}{cmssqi10}

\newcommand{\1}{& \cmsi}
\newcommand{\0}{& \cmss}
\newcommand{\f}{& \cmf }
\newcommand{\T}{& \LARGE\bf}
\newcommand{\B}{& \large\bf}
\newcommand{\linie}{&& \multicolumn{3}{l}{\line(1,0){455}}\\}
\newcommand{\fettlinie}{&& \multicolumn{3}{l}{\rule{455pt}{0.6mm}}\\}
\def\vline#1{&& \multicolumn{#1}{l}{\line(1,0){455}}\\}

\def\stift#1#2#3#4#5#6{\vspace{20mm}\hspace{3.6cm} \cmss\parbox[t]{5.5cm}{#1\\#2\\#3\\#4\\#5\\#6}}
\def\firma#1#2#3{\hspace{3.3cm} \parbox[t]{5.5cm}{#1\\#2\\#3}}
\def\anschrift#1#2#3#4#5#6{\hspace{3.6cm} \cssi #1\\

                         \hspace{3.6cm} \cssi\parbox{5.5cm}{#2\\#3\\#4\\#5\\#6}}
\def\uca#1#2{\hspace{3.3cm} \cmsi\parbox[t]{5.5cm}{#1\\#2}}
\def\ucb#1#2{\hspace{12.2cm} \cmsi\parbox[t]{5.5cm}{#1\\#2}}
\def\grundlage#1#2#3#4{\vspace{18mm}\hspace{3.6cm} \line(1,0){455}

                       \hspace{3.6cm} \cmf\parbox[t]{8cm}{#1\\#2\\#3\\#4}
                       \vspace{-20mm}}


\begin{cmsi}

\end{cmsi}
\newpage
\begin{cmsi}
\stift{Pensionskasse der Stadt Gaga} {Postfach 660} {2540 Gaga} {""} {""} {""}
\vspace{1cm}

\ucb{Verwaltung} {""}
\vspace{19cm}

\grundlage{Grundlage dieser Berechnung bildet das Reglement Ihrer}
          {Pensionskasse.}
          {Erstellt am 25.08.2016 im Auftrag Ihrer Pensionskasse.}
          {}
\vspace{-20.5cm}


\begin{tabular}{p{0cm}p{2.7cm}p{8.6cm}p{5.0cm}r}\\               
\1 \T  Pers"onlicher Ausweis\\ [ 4mm]
\fettlinie
\1 \0  Ausweis g"ultig ab 01.06.2015\1 Vertrag Nr. 1/19        \1 LKR \\  
\1 \0  f"ur Rentenversicherung\\ [ 2mm]
\linie
\0 Versicherte\1 Axxxxxxx Daniel         \\  
\0 Person\1 Geburtsdatum 30.05.1954\1 Vers. Nr. 109.55.201.133  A\\  
\1 \1  Versicherungsbeginn 01.06.2013\\  
\1 \1  Erreichen des Pensionsalters am 01.06.2018\1 \1  Franken            
\\ \linie
\1 \1  J"ahrlicher versicherter Lohn\1 \1   39'994\\  \1 \1  Besch"aftigungsgrad in \%\1   90.000\\  
\1 \1  Ihr Jahresbeitrag\1 \1    5'199\\  \linie
\0 Leistungen im\1 Voraussichtliche Altersrente                                                                                \1 im Alter 64\1   24'005\\  
\0 Alter        \1 Rentensatz in \%\1   60.022\\  
\1 \1  oder voraussichtliches Alterskapital\1 \1   384'080\\ \linie  
\0 Leistungen bei\1 Invalidenrente        \1 nach 24 Monaten Wartefrist\1   23'996\makebox[0cm][l]{*}\\  
\0 Invalidit"at\1 Invaliden-Kinderrente        \1 nach 24 Monaten Wartefrist\1    4'799\makebox[0cm][l]{*}
\\ \linie  
\end{tabular}

\begin{tabular}{p{0cm}p{2.7cm}p{13.1cm}p{0.5cm}r}                
\0 Leistungen im\1 Ehegatten- bzw. Lebenspartnerrente\1 \1    15'003\makebox[0cm][l]{*}\\  
\0 Todesfall\1 Todesfallkapital wenn keine Ehegatten- bzw. Lebenspartnerrente f"allig wird\1 \1    79'988\\  
\1 \1  Waisenrente\1 \1    4'799\makebox[0cm][l]{*}
\\ \linie  
\0 Einkauf\1 M"ogliche Einmaleinlage zur Ausfinanzierung der Rente ab Alter 60 (nach Erwerb der vollen Versicherungsdauer)\1 \1    42'179\\  \linie
\end{tabular}

\begin{tabular}{p{0cm}p{2.7cm}p{16cm}}                           
\0 Hinweise          \1 Bei den vorgenannten Renten handelt es sich um Jahresrenten.        \\  
\1 \1  *) Bei Unfall sind die Leistungen gem"ass den Bestimmungen im Reglement auf das gesetzliche Minimum beschr"ankt.\\  
\end{tabular}
\end{cmsi}
\end{document}
  • May be \def\º{..} works? – Manuel Aug 29 '16 at 11:55
  • Well, the & seems to cause problems. Without having real code this is hard to tell. – user31729 Aug 29 '16 at 11:56
  • 1
    Must not a command name use only ascii characters? – Bernard Aug 29 '16 at 11:58
  • ° ist not a single byte if your file is utf8 encoded. – Ulrike Fischer Aug 29 '16 at 11:59
  • would work with \def and \newcommand, but as Ulrike said: Not with utf8 encoding. Disregarding this for a moment: \def\°{&foo} fails of course due to tab character symbol & -- depending on the context, however – user31729 Aug 29 '16 at 12:03
6

If your files are utf8 encoded -- as would be normal nowadays -- then you can't define a command with \newcommand when using pdflatex as ° is no longer a single byte in utf8 but encoded as 0xC2 0xB0.

It would work with one of the utf8 engines like xelatex or lualatex.

You can also define your command by using the primitive \def as it will "eat" the 0xB0 as parameter, but you should then be carefull and not define another non-ascii char starting with 0xC2:

 %utf8 encoded file ...
\documentclass[]{article}
\begin{document}

%\newcommand\°{& abc} %doesn't work
\def\°{& abc} %works

%\def\±{blub} %<--- not allowed, starts with hex C2 too

\begin{tabular}{ll}
\° 
\end{tabular}
\end{document}

On the whole you should better avoid non-ascii chars in command names when using pdflatex.

  • Hi LaTeX Supporter; Thanks for the HELP. The information that UTF-8 is the wrong format, has made my break-through. Even with \° it runs now. I made sure that our application writes the file as ISO-8859-2 or Windows 1252 not UTF-8. Then I adjusted LaTeXworks to use per default ISO-8859-2 or Windows 1252, and finally I defined my preferences to use the LaTeX language to convert right on start up of LaTeXworks. Since ALL runs like a SNIFF. Thanks a lot. – Sepp as user2439935 Aug 30 '16 at 13:16

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.