mdframed
讓我們考慮使用和 的兩個相似盒裝環境tcolorbox
,由 xelatex/pdflatex 處理:
\documentclass{article}
\usepackage{tcolorbox}
\usepackage{mdframed}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[colback=white,colframe=black,sharp corners=all,boxrule=0.7pt,top=0.2in]
\lipsum[3]
\end{tcolorbox}
\begin{mdframed}[linewidth=0.7pt,innertopmargin=0.2in,innerbottommargin=0.2in]
\lipsum[3]
\end{mdframed}
\end{document}
在縮放 100% 或更大時,我們在所有 PDF 檢視器(Evince、Okular、Adobe Acrobat 等)中看到兩個等效的框
但在 Okular 和 Adobe Acrobat 上,縮放到低於 75% 時,tcolorbox
框架邊框開始鬆動。
是的,問題已經討論過[方框邊框線在 PDF 上無法正確顯示],(關於 Evince 中不正確的光柵化、有罪的 PDF 檢視器等)。
但我發現,mdframed 以某種方式破解了這個問題,並且「mdframed border」在所有 PDF 檢視器中都正常(即使沒有「[framemethod=tikz]」)。
是否可以指定一些神奇的選項/駭客/解決方法來使tcolorbox
行為“像 mdframed”? (「即使在 Okular 和 Adobe Reader 中也能保存所有縮放等級的邊框」)
答案1
tcolorbox 的問題是柵格化邊框和填充背景混亂(感謝@DavidCarlishe)。我們需要 tcolor 框中的透明背景。
更正來源:
\documentclass{article}
\usepackage{tcolorbox}
%\tcbuselibrary{skins}
\usepackage{mdframed}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[standard jigsaw,opacityback=0,colframe=black,sharp corners=all,boxrule=0.7pt,top=0.2in,left=0.1in]
\lipsum[3]
\end{tcolorbox}
\begin{mdframed}[linewidth=0.7pt,innertopmargin=0.2in,innerbottommargin=0.2in]
\lipsum[3]
\end{mdframed}
\end{document}
適用於 Okular 和 Adobe Acrobat 中的所有縮放等級。