![ttfamily 用法(换行失败)](https://linux22.com/image/259718/ttfamily%20%E7%94%A8%E6%B3%95%EF%BC%88%E6%8D%A2%E8%A1%8C%E5%A4%B1%E8%B4%A5%EF%BC%89.png)
使用时我无法插入新行\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}