Re: [問題] 急問 LaTeX 中,文字跑出段落邊界的問題

看板LaTeX (論文排版)作者 (Volodos)時間13年前 (2011/11/27 04:06), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《OurPeace (小貝貝)》之銘言: : 我有一篇很簡單的文章, : 完成品:http://frankcpp.tk/test.pdf : 程式碼:http://frankcpp.tk/test.tex : 可是不知道為什麼,破折號裡的 "sustainable development" 都會超出正常段落邊界。 : (如 PDF 檔所示) : 這樣實在是很奇怪,大家可以幫我排除這個醜樣嗎?感恩。 回推文, 為什麼不會幫忙斷字 因為原檔中, issue---sustainable development---has 會被看成兩個單字 第一個單字是前半部, 第二個單字是後半部 這兩個字會變成沒有 hyphen 的設定 簡單來說, 如果有一個字輸入成 issue-sustainable 那麼 TeX 就不會再斷字, 因為這個字裡已經有 hyphen 所以 'issue-sustainable' 會被看成一個字 --- 的作用跟 - 差不多 再換個例子, difficult 這個字, 輸出的時後, 其實是輸出 7 個字 d i ffi c u l t ffi 是一個字 (在好的字型裡, ffi 會有專門的一個字輸出 這是所謂的 ligature --- 是 ligature 的一部份, 所以 development---has 會變成一個字 這個字有 15 個 char d e v e l o p m e n t --- h a s 所以在 hyphen list 中沒有這個設定 一個比較好的方式是直接用 \textemdash 輸出 --- 的 ligature 也就是原檔變成 issue---sustainable development\textemdash has 這樣 development, \textemdash, has 是三個東西 而原稿就不用再自行設定那裡要 hyphen (也就是推文用的方式) ------------------- 以下是這種情形如何 debug -------------- 首先打開 log 檔, 會看到 Overfull \hbox (39.65237pt too wide) in paragraph at lines 10--30 []\OT1/cmr/m/n/12 When I an-a-lyze global eco-nomic con-di-tions, I find an im-por-tant issue---sustainable development--- [] 裡面有可能 hyphen 的位置 然後會發現我說的情況, --- 那裡沒有 hyphen, 所以 development 幾本上不會斷字 如果不想要 \textemdash, \textendash 之類的指令 要手動加 hyphen, 又不想改變 tex 原先的 hyphen 設定 原稿輸入 \showhyphens{development} 然後再打開 log 檔, 會看這一行 [] \OT1/cmr/m/n/12 de-vel-op-ment 前半部不要管, 那是字型編碼設定 後面是這個字在 hyphen list 中的內定值 然後手動把 development 改成如推文所說的方式即可 還有一個方法算比較單純 不用每次都 \textemdash 把原稿改成 issue\,---\,sustainable development\,---\, 會在 --- 的左右加上很小的空白, 這會強迫 development 跟 --- 變成不同的字 而且輸出上, 我覺得比較好看, 我自己比較建議這麼處理 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 68.231.175.130

11/27 09:10, , 1F
專業推
11/27 09:10, 1F
文章代碼(AID): #1EqKQjF- (LaTeX)
文章代碼(AID): #1EqKQjF- (LaTeX)