I am using making a list of common math commands in LaTeX, and I'm using the listings package to put them in a code format. However, I want some of the commands to be in the same line, instead of having to take up a new line (sort of like we can type code inline vs in a block) but some to stay in a block. How can I do this? It doesn't have to use the listings package.
A sample of my code is
\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{listings,mdframed}
\usepackage{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\DeclareRobustCommand{\diamondtimes}{%
\mathbin{\text{\rotatebox[origin=c]{45}{$\boxplus$}}}%
}
\lstset{
language=[LaTeX]TeX,
backgroundcolor=\color{black!5}, % set backgroundcolor
basicstyle=\footnotesize\ttfamily,% basic font setting
columns=fullflexible,
}
\title{Math in LaTeX}
\author{v.0.1}
\begin{document}
\maketitle
\section{Simple, Inline Equations}
You can do a simple inline equation by using \begin{lstlisting}
$ an equation here $
\end{lstlisting}
For example, you might do
\begin{lstlisting}
$\lim\limits_{n \to \infty} \frac{1}{2^n} i\bar z$
\end{lstlisting}which produces $\lim\limits_{n \to \infty} \frac{1}{2^n} i\bar z$.
\end{document}
Any help would be appreciated. Thanks!

\lstinline!var i:integer;!– samcarter_is_at_topanswers.xyz Aug 18 '16 at 19:29