A LyX document I wrote won't compile after I added in a mathematical formula the command root (in fact, \root[k]{\alpha}). I would have written you the code, but the document is long (over than 20 pages), so it would be too much. Any ideas on how to solve it?

Thanks in advance.


The specific line is:

Let $\alpha\in\mathbb{R}$. Then 

And the error message is:

"A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)"

Edit 2:

Here is the problematic part, I created a new document and this one doesn't compile on LyX.]

%% LyX 2.0.6 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.






Let $R=\ELT{\mathbb{R}}{\mathbb{C}}$, and take $\alpha=\layer a{\ell}\in R$
and $k\in\mathbb{N}$. Then $\sqrt[k]{\alpha}$.\end{defn}

  • Welcome to TeX.SX! The command to create a square root sign is \sqrt, not \root. And a general comment: example code for questions should always be as short as possible. That means you should make a copy of your document, and remove everything that doesn't influence whether the error occurs or not. In some cases you may need to go through some trial and error, but in this case you could probably have removed everything but a single equation containing the command. It's also helpful to report the entire error message that you get. – Torbjørn T. Jan 19 '15 at 15:13
  • Thanks @TorbjørnT. both for your help and your advice. I will write as you suggested (and will now edit to show the code), but I need the (k)-th root rather than a square root... – Guy Jan 19 '15 at 15:18
  • We need an MWE! We can't guess what is happening. The MWE I prepared in order to help you works just fine: \documentclass{article}\usepackage{amsfonts} \begin{document}Let $\alpha\in\mathbb{R}$. Then \[\sqrt[k]{\alpha}\]\end{document} – LaRiFaRi Jan 19 '15 at 15:28
  • @Guy the command is \sqrt even for the kth root. – David Carlisle Jan 19 '15 at 15:29
  • @DavidCarlisle this command returns the same error... – Guy Jan 19 '15 at 15:39

You have redefined the the internal command \raise used for moving boxes up and down. Such boxes typically contain characters to typeset. This is used in the optional argument of the \sqrt command to get the symbol at an appropriate height, and in many other places in LaTeX. In fact, I am surprised that nothing else in your document triggered the error. Removing your redefition of \raise, gives a file that compiles without errors.

The fact that you had to use \renewcommand rather than \newcommand should have lead you to check what command you were redefining. One first way to find the current definition of a command is to write \show before it. For a standard file \show\raise produces

> \raise=\raise.

indicating that it is a primitive. In comparison \show\sqrt gives

> \sqrt=macro:
->\protect \sqrt  .

demonstrating that \sqrt is a macro, whereas \show\myundefinedcommand gives

> \myundefinedcommand=undefined.

Other methods for unravelling command definitions are discussed in the questions

| improve this answer | |

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.