LaTeX Is it possible to define in LaTeX documents Latex Help

  • Thread starter Thread starter Dragonfall
  • Start date Start date
  • Tags Tags
    Latex
AI Thread Summary
In LaTeX documents, users can define custom commands to simplify notation. By using the command \newcommand{\ket}[1]{{\left| {#1} \right>}}, one can easily write quantum state vectors like \ket{X} instead of typing \left| X \right> each time. This approach can also be applied to create similar commands for bra vectors and inner products, such as \bra and \braket, enhancing efficiency in document preparation. This method streamlines the writing process for those frequently using quantum mechanics notation in their LaTeX documents.
Dragonfall
Messages
1,023
Reaction score
5
Is it possible to define in LaTeX documents something like \ket{X} to be \left| X\right> so I don't have to type that every time?
 
Last edited by a moderator:
Physics news on Phys.org


If you put this in your preamble \newcommand{\ket}[1]{{\left| {#1} \right>}}, then you can use the command \ket{X}:

\newcommand{\ket}[1]{{\left| {#1} \right>}} \ket{X}

You can write similar commands for \bra and \braket, say.
 


Awesome, thanks!
 
Back
Top