Tikz: scrbook または book を使用する場合の異なる位置決め動作

Tikz: scrbook または book を使用する場合の異なる位置決め動作

tikz 画像をさまざまな種類のドキュメント クラスに埋め込むと、非常に厄介な違いが発生します。次の MWE を提供しました。

\documentclass[
]{book}           
%]{scrbook}           
\usepackage{tikz} 

\begin{document}

\begin{tikzpicture}
        \draw [rounded corners, fill=green!10] (-4,0) node [anchor=north west]{xXxXxXxXxXxXx} rectangle (4,-3);
    \node[draw] (n1)  { node 1};
    \node[below of=n1, draw] (n2)  { node 1};
    \node[below right of=n2, draw] (n3)  { node 1};

\end{tikzpicture}

\end{document}

使用するとbook次のようになります:

ここに画像の説明を入力してください

しかし、scrbook私は次のことを得ます:

ここに画像の説明を入力してください

残念ながら、tikz 画像には両方のクラスのドキュメントを使用する必要があります。変位をなくすにはどうすればよいですか? ご協力いただければ幸いです。

答え1

例を実行すると、bookクラスは次のように出力します。

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-08-07>
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/book.cls
Document Class: book 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/bk10.clo))

10pt フォントを使用していることが示されていることに注意してください。一方scrbook

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-08-07>
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2020/07/22 v3.31 KOMA-Script document class (book)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrlfile.sty)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)

デフォルトで 11pt が使用されていることがわかりますか?

フォント サイズが異なるとテキストの幅も異なるため、同じ画像を作成するには同じフォント サイズを使用する必要があります。

関連情報