Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am stuck on the following problem and don't know how to solve it. Here is my problem :

\documentclass{article}
\begin{document}

 \begin{verbatim}'\hfill\end{verbatim} MKS' which puts the word 'MKS' at the far right of the page where as  \begin{verbatim}'\noindent \end{verbatim}MKS' which
 puts  'MKS ' at the far left  of  the page in the same line.

\end{document}

Produces :

enter image description here
But I,d like to produce :
enter image description here

The text within \begin{verbatim} and \end{verbatim} makes a new line and takes a whole line for this text only within in it. This looks ugly. I want to get it with the other text. How can I do this?

share|improve this question
    
Perhaps consider marking some of your questions that have acceptable answers. See How do you accept an answer? –  Werner May 3 '13 at 13:29
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs May 23 '13 at 12:36

1 Answer 1

The inline (or short-hand) use of the verbatim environment is \verb<char><stuff><char> where you specify <char> as anything other than *. Choose a character that does not occur within <stuff>. In your instance, you would use:

enter image description here

\documentclass{article}
\begin{document}
\verb|'\hfill| MKS' which puts the word `MKS' at the far right of the page where as 
\verb|'\noindent| MKS' which puts `MKS' at the far left of the page in the same line.
\end{document}

The *-variant \verb* prints the spaces as well.

share|improve this answer
    
thank you.My problem is solved. +1 for you. –  Md Kutubuddin Sardar Apr 9 '13 at 5:27
2  
@MdKutubuddinSardar: You should accept this answer, by clicking the tick mark next to the answer. That will mark the question as answered. –  Jake Apr 12 '13 at 8:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.