TeXMaker の xelatex の問題

TeXMaker の xelatex の問題

次のコードは、Mac OS 上の XeLaTeX + ViewPDF を使用した TeXMaker で動作します。

\documentclass{article}
%\usepackage{pst-3dplot}
 \newcommand{\C}{\mathbb{C}}
 %\usepackage{pstricks,auto-pst-pdf}
  \usepackage{pst-3dplot}
  %\usepackage{pst-math}
  % ...
  \begin{document}
   % ...
  \begin{center} 
  \begin{pspicture}(0,0)(8,5)
  \psdot(1,3)
  \psline(0,0)(8,2)
  \rput(1,3.3){$A$}
  \rput(0.2,0.5){$L$}
  \rput(8, 3){$NICE$}
  \end{pspicture}
  \end{center} 
  % ...
  \end{document}

しかし、このコードをいつもの前置きと共に使用すると、

    \documentclass[a4paper, 10pt, twoside, headsepline, pointlessnumbers]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[pdftex]{graphicx}

\usepackage{latexsym}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{microtype}
\usepackage{xcolor}

\usepackage{tocstyle}
        \usepackage{mdframed}
        \usetocstyle{KOMAlike}
        \usepackage[hidelinks]{hyperref}
        \usepackage{mathtools}
        \usepackage{float}
        \setcounter{MaxMatrixCols}{20}
        \newcommand{\RM}[1]{\MakeUppercase{\romannumeral #1{}}}
        \makeatletter \g@addto@macro\@floatboxreset\centering        \makeatother
       \usepackage{verbatim}
       \usepackage{multirow}
       \usepackage{booktabs}
       \usepackage{array}
       \usepackage{comment}
       \usepackage{esvect}
       \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
       \usepackage{collcell}

       \usepackage{pst-3dplot}

      %\usepackage{pst-3dplot}

       \newcommand{\C}{\mathbb{C}}

      %\usepackage{pstricks,auto-pst-pdf}

      \usepackage{pst-3dplot}
     %\usepackage{pst-math}

     % ...



     \begin{document}

     % ...

     \begin{center} 
     \begin{pspicture}(0,0)(8,5)
     \psdot(1,3)
     \psline(0,0)(8,2)
     \rput(1,3.3){$A$}
     \rput(0.2,0.5){$L$}
     \rput(8, 3){$NICE$}
     \end{pspicture}
     \end{center} 

     % ...

     \end{document}

「コマンド \C は既に定義されています」、「未定義の制御シーケンス \ifnum \pdfshellescape...」などのエラーがいくつか発生します。

問題はどこだ?

答え1

各usepackageの後に挿入すると、\show\Cそれが未定義であることがわかります。

> \C=undefined.
l.19 \show\C

? 
(./hyperref.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/local/texlive/2019/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/url/url.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/hxetex.def
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/stringenc.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
> \C=macro:
->\PU-cmd \C \PU\C .
l.21 \show\C

これはhyperrefが定義したものです。その定義が必要ない場合は、定義を作成するときに、その定義で\renewcommandはなく\newcommand、その定義を使用するか、または名前を選択してください。あなたの命令で自由に。

xelatex では T1 エンコーディングを使用しないでください (ハイフネーションが間違ってしまいます)。

だから削除すべきだ

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

また使用する

\usepackage{graphicx}

ない

\usepackage[pdftex]{graphicx}

オプション引数は、xetex 上で実行されていることが検出された場合でも、graphicx に pdftex 固有のコードを使用するように強制するだけなので、ほとんど使用しないでください。このpdftexオプションは無害ですが、pdftex を使用している場合には必要ありません。それ以外の場合はエラーが発生します。

関連情報