Is it possible to define in LaTeX documents Latex Help

  • Context: LaTeX 
  • Thread starter Thread starter Dragonfall
  • Start date Start date
  • Tags Tags
    Latex
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
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}:

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

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


Awesome, thanks!