![ConTeXt のフロート: キャプション名を変更して \input コマンドを機能させる](https://rvso.com/image/281590/ConTeXt%20%E3%81%AE%E3%83%95%E3%83%AD%E3%83%BC%E3%83%88%3A%20%E3%82%AD%E3%83%A3%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3%E5%90%8D%E3%82%92%E5%A4%89%E6%9B%B4%E3%81%97%E3%81%A6%20%5Cinput%20%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%82%92%E6%A9%9F%E8%83%BD%E3%81%95%E3%81%9B%E3%82%8B.png)
ロジック回路用の新しい float を定義しましたlogigram
:
\definefloat [logigram] [logigrams]
ConTeXt のモード (条件付き処理など) を利用して、ドキュメントのフランス語版と英語版を並行して作成しています。
\starttext
\startmode [english]
\placelogigram [right] {Logigram of a negation} {\input negation.tikz}
The logic circuit of a negation is the opposite logigram.
\stopmode
\starmode [french]
\placelogigram [right] {Logigramme d'une négation} {\input negation.tikz}
Le circuit logique d'une négation est le logigramme ci-contre.
\stopmode
\stoptext
\placelogigram
ここで、デフォルトのキャプション名を英語では「Logigram」、フランス語では「Logigramme」にしたいと思います。
negation.tikz.tex
また、コマンド\input
が内部で使用されている場合、 ConTeXt は Tikz 画像を見つけることができないことにも気付きました\placelogigram
。これはファイルですnegation.tikz.tex
:
%\usemodule [tikz]
%\usetikzlibrary [circuits.logic.US]
\starttikzpicture [circuit logic US]
\node [not gate, point down, draw] at (0, 0) (notGate) {};
\draw (notGate.input) -- ++(up:0.5) node [above] {$\phi$};
\draw (notGate.output) -- ++(down:0.5);
\stoptikzpicture
ご協力いただければ幸いです。
答え1
french
モードでコンパイルするときに使用する言語としてフランス語を設定する:
\startmode [french]
\language [french]
\setcharacterspacing [frenchpunctuation]
\mainlanguage [french]
\stopmode
変更:
\definefloat [logigram] [logigrams]
に:
\definefloat [logigram] [logigrams]
\setuplabeltext [fr] [logigram=Logigramme~]
キャプション名の問題を解決します。
私はの\startplacelogigram ... \stopplacelogigram
代わりに を使って を取得しました:\placelogigram
\input
\startmode [english]
\startplacelogigram [location=right, title={Logigram of a negation.}]
\input negation.tikz
\stopplacelogigram
The logic circuit of a negation is the opposite logigram.
\stopmode
\startmode [french]
\startplacelogigram [location=right, title={Logigramme d'une négation.}]
\input negation.tikz
\stopplacelogigram
Le circuit logique d'une négation est le logigramme ci-contre.
\stopmode
編集。コメントに示されているように、の代わりにまたは の\startplacelogigram ... \stopplacelogigram
使用を避けてください。\input filename \relax
\ReadFile {filename}
\input filename