2
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{mdframed}%tto frame a whole section
\usepackage{amsmath}
\usepackage{cancel}%to cancel a equation to 0
\usepackage{braket}%to impose
\usepackage[a4paper, total={6in, 10in}]{geometry}% let's us select the mergin of the page
\title{The Boltzmann Equation}
\author{Adrish Chatterjee}
\date{July 2024}

\begin{document}
$$={a_\Vec{k}}^{(a)}\sqrt{1\pm n_a}\sqrt{V}\ket{(n),k_a^+}-{a_\Vec{k}}^{(a)\dag}\sqrt{n_a}\sqrt{V}\ket{(n}\ket{(n),k_a^-}$$
\end{document}

My code is giving me a desired output but it is giving me the above mentioned error. Can someone tell me what is the problem.

1
  • 1
    welcome! output is not reliable following an error - it is just intended as a debugging aid. Commented Nov 2, 2024 at 5:19

1 Answer 1

4

If you type _abc LaTeX interprets a as the subscript. If you type _\Vec{k}, it interprets \Vec as the subscript, but this is not valid because \Vec expects an argument.

The correct syntax for a subscript is _{<subscript>}. You can get away with dropping the curly brackets if <subscript> is a single token such as a or \alpha, but you cannot do so otherwise because TeX has no way to know when the subscript stops. It just takes the next token, whatever that happens to be.

Not the cause of the error, but don't use $$...$$ for display maths in LaTeX. Always use \[...\] (or a suitable environment, obviously).

So, you want something like

\[
  =a_{\Vec{k}}^{(a)}\sqrt{1\pm n_a}\sqrt{V}\ket{(n),k_a^+}-a_{\Vec{k}}^{(a)\dag}\sqrt{n_a}\sqrt{V}\ket{(n}\ket{(n),k_a^-}
\]

[Note that I'll probably end up deleting this answer.]

1
  • 1
    Thank you very much it worked!! Commented Nov 3, 2024 at 4:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.