如何使用 \usepackage{pst-barcode}

如何使用 \usepackage{pst-barcode}

使用時\usepackage {pst-barcode} 出現錯誤:

  \documentclass[10pt,a4paper,twoside,openany]{book}
\usepackage[spanish]{babel}
\usepackage[dvipsnames,x11names]{pstricks}% Options for xcolor
\usepackage{pst-barcode}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{pspicture}(3.5,1.2in)
\psbarcode[linecolor=red]{1613198400316}{includetext inkspread=0.1}{ean13}
\end{pspicture}
\end{document}

在此輸入影像描述

答案1

xcolor您可以傳遞via的選項pstricks

\documentclass{article}
\usepackage[dvipsnames,x11names]{pstricks}% Options for xcolor
\usepackage{pst-barcode}
\begin{document}
\begin{pspicture}(3.5,1.2in)
\psbarcode[linecolor=red]{1234567}{includetext inkspread=0.5}{ean8}
\end{pspicture}
\end{document}

xcolor本身預設加載color

\psbarcode[linecolor=red]{1613198400317}{includetext inkspread=0.5}{ean13}

在此輸入影像描述

在此輸入影像描述

答案2

Pstricks(由 加載pst-barcode)已經加載,xcolor沒有選項。如果您向後者載入一個選項,則會出現「選項衝突」。解決方案包括從文件類別中載入該選項,該選項會將其建議給所有後續包,直到其中一個包識別它為止。

替代解決方案:寫在序言中\PassOptionsToPackage{selected options}{xcolor}

相關內容