\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ます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オプションなしでロードされています。後者をオプション付きでロードすると、「オプションの衝突」が発生します。解決策は、ドキュメント クラス内からオプションをロードすることです。これにより、後続のすべてのパッケージにオプションが提案され、そのうちの 1 つがそれを認識するまで続きます。

代替解決策: 序文に記述します\PassOptionsToPackage{selected options}{xcolor}

関連情報