
我使用了以下程式碼:
\documentclass[12pt,reqno]{book}
\begin{thebibliography}{99}
\addcontentsline{toc}{chapter}{Bibliography}
\bibitem{lecture11}http://math.mit.edu/classes/18.745/Notes/Lecture_11_Notes.pdf
\bibitem{Wiki1}https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_A1xA1.svg
\bibitem{Wiki2}https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_A2.svg
\bibitem{Wiki3}https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_B2.svg
\bibitem{Wiki4}https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_G2.svg
\end{thebibliography}
不幸的是,它沒有編譯,但是當我放置這樣的假網站時https://en.wikipedia.org/wiki/Root-system/media/File:Root-system-G2.svg, 有用。因此,如果有人能夠修復這個錯誤,我將非常感激和感激。
答案1
我建議您加載該xurl
套件並將每個 URL 字串包含在\url{...}
指令中。請注意,URL 字串可能(並且經常)包含諸如_
和 之類的字符#
,這些字符在 TeX 中具有特殊含義。將 URL 字串封裝在\url
指令中是正確的方法。
\documentclass[12pt,reqno]{book}
\usepackage{xurl}
\begin{document}
\begin{thebibliography}{99}
\addcontentsline{toc}{chapter}{Bibliography}
\bibitem{lecture11} \url{http://math.mit.edu/classes/18.745/Notes/Lecture_11_Notes.pdf}
\bibitem{Wiki1} \url{https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_A1xA1.svg}
\bibitem{Wiki2} \url{https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_A2.svg}
\bibitem{Wiki3} \url{https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_B2.svg}
\bibitem{Wiki4} \url{https://en.wikipedia.org/wiki/Root_system#/media/File:Root_system_G2.svg}
\end{thebibliography}
\end{document}
附錄,以滿足OP的後續請求:
我想改變網站的顏色。怎麼做?
我假設您的意思是希望更改 URL 字串的顏色。 (你不需要 LaTeX 來改變網站的顏色,是嗎?)我建議你在序言中加入以下幾行程式碼,後載入xurl
包:
\usepackage{xcolor}
\usepackage[colorlinks]{hyperref}
\hypersetup{urlcolor=red} % or blue, or orange, or whichever color you prefer
根據這些說明,URL 字串將以您透過選項設定的任何顏色呈現urlcolor
。