# Prevent LaTeX from inserting a new line [closed]

How do I prevent LaTeX from inserting a new line?

Here's the code:

bla bla bla
\begin{verbatim}C:\Program Files\Product Name\Some other extensions\mail box name\end{verbatim}


The output is:

bla bla bla

C:\Program Files\Product Name\Some other extensions\mail box name

That's my problem: I'm unable to prevent LaTeX from inserting a new line after "bla".

Is my problem somewhat related with the fact that I'm using verbatim?

-

## closed as unclear what you're asking by Jubobs, Jesse, Sean Allred, Marco Daniel, Andrew SwannMar 3 at 10:13

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

You might want \verb|C:\Program Files\Product Name\Some other extensions\mail box name| –  cgnieder Dec 15 '12 at 15:14
@cgnieder: Your comment worse an answer! –  m0nhawk Dec 15 '12 at 15:18
I must use verbatin not \verb –  g9999 Dec 15 '12 at 15:24
\verbatim always starts a new line. –  barbara beeton Dec 15 '12 at 15:24
Why do you have to use {verbatim}? It's to be used for displayed verbatim material whereas \verb is for inline material. –  cgnieder Dec 15 '12 at 16:27

I must use verbatim not \verb

is a bit confusing. You apparently want inline verbatim material yet not want to use the command that produces it. Unless you can explain why \verb (or listings' \lstinline or minted's \mint or ...) doesn't work for you you're unlikely to get a better answer than what I already said in the comments.

\documentclass{article}
\usepackage[T1]{fontenc}
\begin{document}

\noindent
Some inline verbatim \verb|&%$_^| and some displayed material: \begin{verbatim} &%$_^
\end{verbatim}
Some text after to show the spacing

\end{document}


If you insist in using an environment for inline verbatim material you could use fancyvrb's BVerbatim environment which puts its contents in a TeX box. It might still not be what you're looking for when you need more than one line, though:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fancyvrb}

\begin{document}

Some text before
\begin{BVerbatim}[gobble=1]
&%\$_^
\end{BVerbatim}
\ Some text after to show the spacing

\bigskip

text
\begin{BVerbatim}
two
lines
\end{BVerbatim}
\ text

\bigskip

bla bla bla
\begin{BVerbatim}
C:\Program Files\Product Name\Some other extensions\mail box name
\end{BVerbatim}

\end{document}


Note that the last example will cause an overfull \hbox.

-