Entering Code in LaTeX Documents

  • Context: LaTeX 
  • Thread starter Thread starter Dustinsfl
  • Start date Start date
  • Tags Tags
    Code Latex
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 3K views
Dustinsfl
Messages
2,217
Reaction score
5
How can I enter code in Latex documents?
 
Physics news on Phys.org
dwsmith said:
How can I enter code in Latex documents?

Hi dwsmith, :)

One way to do this is to surround your text with \verb|...| command. Examples,

\[\verb|$y=2x+1$|\]

\[\verb|\prod_{i=m}^{\infty}x_{i}=\lim_{n\to\infty}\prod_{i=m}^{n}x_{i}|\]

For larger portions of text use the \(\verb|\begin{verbatim}...\end{verbatim}|\) environment. Kind Regards,
Sudharaka.