Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
! Undefined control sequence.
\@title ->Home work \\ Economics \No 
                           ~2
l.16 \maketitle

Today, I tried to change my text-editor from TeXworks to TeXStudio (and MiKTeX to TeXLive also) and run there (in TeXStudio, which connected with packages of TeXLive) my homework. So, as you see above, the problem is connected with the "\No~2".

TeXworks worked it out fine and put the sign, but TeXStudio did not. And when I remove "\No", undoubtedly, TeXStudio works okay too.

Is there any opportunity to teach TeXStudio a Number sign (\No) in \maketitle? In the rest of the text it does not works too.

\documentclass[12pt]{article}
\usepackage{cmap}
\usepackage[utf8]{inputenc} 
\usepackage[russian]{babel}
\usepackage{amsmath}
\usepackage{graphicx} 
\usepackage{array}

\title{Home work \\ Economics \No~2}

\author{MY name}

\date{12 may 2014}

\begin{document}

\maketitle

\textbf{\large Task 1}

Some stuff

\end{document}

P.S.: when I put "\No~2" in some part of the text (not in title information) it does not work too. I think, that I have to say that this is the russian symbol (№) of a number. The sign is slightly differ from the English one (No. or #).

I need this: \No~2 by texworks in \maketitle

share|improve this question
    
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Johannes_B May 17 at 10:55
1  
Texworks and texstudio are merely editors, if you didn't change the distribution (TeX Live) iinbetween they should both give the same results. –  Johannes_B May 17 at 10:56
    
Thanks, Johannes_B. Yes, sorry, I edited my question. Also, I have changed MiKTeX to TeXLive. However, the texworks, which is in TeXLive-package too has no trouble with "\No" –  Vladimir Yashin May 17 at 10:58
    
Your example doesn't work because \No is not defined. You need to define it, or load a package that defines it. –  Ian Thompson May 17 at 11:09
    
Thanks @IanThompson. I have not understood why texworks (either MikTeX's or TeXLive's) put the \No without any definition, but whereas in contrast TeXStudio has a trouble to do it. –  Vladimir Yashin May 17 at 11:50

3 Answers 3

up vote 2 down vote accepted

The symbol is provided by textcomp which defines \textnumero but you can create \No as a new command to produce the same symbol:

\documentclass[12pt]{article}
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{textcomp}
\newcommand*{\No}{\textnumero}

\title{Home work\\Economics \No~2}

\author{MY name}

\date{12 may 2014}

\begin{document}

\maketitle

\section*{Task 1}% use semantic markup

Some stuff

\end{document}

Incidentally, this symbol also means 'number' in British English but is maybe a little old fashioned and so tends not to be used. (I guess because No. probably got used when typewriters were unable to produce specialised symbols but I'm not sure.)

Number symbol

share|improve this answer
    
Thank you. I am inclined to believe that this answer is the most laconic in comparison to others and also contains advise (for me) regarding \section* (brilliant idea!). To be honest, I have not tried solution of cfr's (about "\No"), because I returned back from TeXLive to MiKTeX and embeded TeXStudio in MiKTeX and TeXStudio started to work fine on MiKTeX stuff so no need to do it. –  Vladimir Yashin May 17 at 19:12
    
@VladimirYashin Does your document use different fonts in that case? I'm curious because I noticed that TeX Live used not type1 but metafont fonts when I ran your code and Bernard's answer suggests that might well make a difference. –  cfr May 17 at 19:24
    
sorry, may be I do not quite understand, but whatever, I use the default font (CMU Serif) it is fully satisfied me, esp. with the "cm-super"-package. –  Vladimir Yashin May 17 at 19:42

The russian option of babel defines a \No macro for cyrillic numero sign (Unicode "2116). You can get it using the Latin Modern font and loading fontenc with T2A, TS1, T1 option.

You also obtain it with XeLaTeX, loading the fontspec and polyglossia packages. Then you have to define the\No command.

Here is a code that can work both ways (commenting and uncommenting the relevant parts):

\documentclass[12pt]{article}

%\usepackage[utf8]{inputenc}
%\usepackage[T2A, TS1,T1]{fontenc}
%\usepackage{lmodern}
%\usepackage[russian]{babel}

\usepackage{fontspec}
\setmainfont{Minion Pro}
\usepackage{polyglossia}
\setmainlanguage{russian}
\providecommand\No{\char"2116}%{№}%

\title{Home work \\ Economics \No ~2}

\begin{document}

\maketitle

\end{document} 

And the results of both ways, the XeLaTeX way with Minion Pro:

enter image description here

enter image description here

share|improve this answer
    
Is may supposed to print like that? Note that I am by no means asserting that it is not. I'm just curious as I'm essentially wholly ignorant of what to expect with russian and it looks confusingly like a partially mirrored mar to my ignorant eyes. –  cfr May 17 at 19:22
    
Also, I can't get your commented code to work - it complains \No is undefined. Moreover russian.ldf, at least, does not appear to define any such command. –  cfr May 17 at 19:50
    
@cfr: As to may, I don't know: as you can see, the code doesn't contain any reference to \date and I don't speak Russian, so I have no idea whether it looks weird or not. I can't remember where I read a \No command did exist with the russian option of LaTeX, but it struck me because there does exist such a command in frenchb, so I simply decided to test it… and it worked on my system! That's all I can say. Perhaps because I use MiKTeX, and latest babel for MiKTeX is 3.8 m? –  Bernard May 17 at 22:20
    
It does not work in TeX Live. (This is the updated-up-to-the-freeze 2013 version.) My babel is 3.9k so perhaps that's the difference? –  cfr May 17 at 23:33
    
Yes, I wonder. Strangely, if I type \newcommand\No{…}, I have the command already defined error message with the russian option of babel, and no message without this option. –  Bernard May 18 at 0:04

As Ian said, you have not defined a macro \No in the document class or any loaded package, at least in your TeX Live distribution, so any editor will produce the same error (also TeXworks).

But is is simple define \No in your preamble as you want. For example:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc} 
\usepackage[russian]{babel}
\newcommand\No{N.\textsuperscript{o}}
\title{Home work \\ Economics   \No ~2}
\begin{document}
\maketitle
\end{document}

Because you are using babel that in russian use the shorthand ", you can also define a new shorthand for ordinals. For example:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\defineshorthand{"o}{$.\!$º}
\begin{document}
\title{Home work\\Economics N"o~2}
\maketitle
N"o $\neq$ N.\textsuperscript{o}
\end{document}

Note that if you want to use the shorthand in the \title, it must be in the body of the document, before of \maketitle, but not in the preamble.

BTW, as most fonts use a not underlined \textordmasculine symbol, very similar to the degree symbol, if you want it underlined without change the font, you can define you macro/shorthand to write some like:

N$\!$.$\!$\textsuperscript{\tiny\underline{o}}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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