使用时我无法插入新行\ttfamily
。有什么原因\ttfamily
阻止我这样做吗?
我的问题(这是代码):
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}
\newline
我反复尝试在单词后插入命令is
以获得输出:
Let's consider an e-commerce web application whose address is:
https://website-test.com/scripts/GetEBook.aspx?file=ebook7.pdf
但不幸的是,它不起作用...我没有得到新的线路。
另外,如何插入空格以使文本向前移动?
例如:
\begin{ttfamily} \verb https://website-test.com/scripts/GetEBook.aspx?file= \end{ttfamily}
\begin{ttfamily} \verb ..\..\windows\repair\sam \end{ttfamily}
我希望输出是:
https://website-test.com/scripts/GetEBook.aspx?file=
..\..\windows\repair\sam
如果\ttfamily
不允许做我需要的事情,还有其他方法可以解决问题吗?
答案1
\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}
但是如果你要写一个 url 地址,最好使用url
package。这里的好处是,如果和 一起使用hyperref
,可以让 url 可点击。
\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}