3

I'm unable to insert a new line while using \ttfamily. Is there any reason why \ttfamily prevents to do that?

My problem (here's the code):

Let's consider an e-commerce web application whose address is:
\begin{ttfamily} https://website-test.com/scripts/GetEBook.aspx?file=ebook7.pdf \end{ttfamily}

I repeatedly tried to insert the \newline command after the word is in order to get the output:

Let's consider an e-commerce web application whose address is:

https://website-test.com/scripts/GetEBook.aspx?file=ebook7.pdf

But unfortunately it doesn't work...I get no new line.

Also, how do I insert spaces in order to move the text forward?

For example:

\begin{ttfamily} \verb https://website-test.com/scripts/GetEBook.aspx?file= \end{ttfamily}
\begin{ttfamily} \verb ..\..\windows\repair\sam \end{ttfamily}

I'd like the output to be:

https://website-test.com/scripts/GetEBook.aspx?file=
                            ..\..\windows\repair\sam

If \ttfamily doesn't allow to do what I need, is there any other way to solve the problem?

5
\documentclass{article}
\usepackage{url}

\begin{document}
\noindent Let's consider an e-commerce web application whose address is:
\vspace{.5cm}
\par\noindent
\begin{ttfamily}%
https://website-test.com/scripts/GetEBook.aspx?file=ebook7.pdf
\end{ttfamily}
\par\noindent
\begin{ttfamily}%
https://website-test.com/scripts/GetEBook.aspx?file=
\end{ttfamily}
\par\noindent
\begin{ttfamily}%
\hspace{5.2cm}\verb|..\..\windows\repair\sam|
\end{ttfamily}

\end{document}

enter image description here

However, if you are trying to write a url address, it is better to use url package. Here the advantage is, if used with hyperref, you can make the url click-able.

\documentclass{article}
\usepackage{url}

\begin{document}
\noindent Let's consider an e-commerce web application whose address
is:\\[.5cm]
\url{https://website-test.com/scripts/GetEBook.aspx?file=ebook7.pdf}
\par\noindent
\url{https://website-test.com/scripts/GetEBook.aspx?file=}\\
\hspace*{5.2cm}\verb|..\..\windows\repair\sam|
\end{document}
  • thanks very much..but if I'm not wrong after the phrase "whose address is:" there's no space..While the solution to the other problem (horizontal space) works perfectly.. – g9999 Dec 8 '12 at 9:49
  • @ Harish Kumar I mean I should get a new line..as I stated ..I used the command \\ as you did now..thanks – g9999 Dec 8 '12 at 10:02
  • @g9999 We say thanks here in TeX.SX by upvoting and accepting the most useful answer (by clicking the green check mark below the votecount) so that the question may be considered as answered. This is the tradition followed here. You may wait for some time before accepting the answers, though. – user11232 Dec 8 '12 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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