- When varwidth is set to true, we must use justification=\centering rather than preset={\centering} to center formated contents.
- When varwidth is set to false, we must use preset={\centering} rather than justification=\centering to center formated contents.
Code: Select all
\documentclass{article}
\usepackage{showexpl}
\lstset{explpreset={language={[LaTeX]TeX},numbers=none,rframe={},frame=single,pos=b}}
\begin{document}
\begin{LTXexample}[varwidth=false,preset={\centering}]
with \verb+varwidth=false,preset={\centering}+
\end{LTXexample}
\vspace{2\baselineskip}
\begin{LTXexample}[varwidth=true,preset={\centering}]
with \verb+varwidth=true,preset={\centering}+
\end{LTXexample}
\vspace{2\baselineskip}
\begin{LTXexample}[varwidth=true,justification=\centering]
with \verb+varwidth=true,justification=\centering+
\end{LTXexample}
\vspace{2\baselineskip}
\begin{LTXexample}[varwidth=false,justification=\centering]
with \verb+varwidth=false,justification=\centering+
\end{LTXexample}
\end{document}
Thank you.
Yoyoimut