
高さの異なる4つの数字を行列に並べようとしています。コンパイルできる私のコードここは:
\documentclass[journal=aamick]{achemso}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\title{hi}
\begin{document}
\maketitle
\newlength{\w}
\setlength{\w}{.9\paperwidth}
\noindent \begin{tikzpicture}[align=center]
\matrix[column sep=.0\w,row sep=.0\w,%
every node/.style={draw,node distance=0 and 0,outer sep=0},xshift=-.048\w]{
\node [label=above:(a)] (a) {\includegraphics[width=.14\w]{figs/16_4.jpeg}}; &
\node [label=right:(d)] (d) {\includegraphics[width=.14\w]{figs/16_10.jpeg}};\\
\node [label=below:(b)] (b) {\includegraphics[width=.14\w]{figs/8_4.jpeg}}; &
\node [label=right:(c)] (c) {\includegraphics[width=.14\w]{figs/8_10.pdf}};\\};
\end{tikzpicture}%
\end{document}
私が得ているものは次のとおりです:
左のボックスの間に隙間(赤い矢印)があります。私が欲しいのは次のようなものです:
これどうやってするの?
答え1
アンカーを適切に設定するだけで、
row 1/.style={anchor=south},row 2/.style={anchor=north}
マトリックスのオプションに。
\documentclass[journal=aamick]{achemso}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\title{hi}
\begin{document}
\maketitle
\newlength{\w}
\setlength{\w}{.9\paperwidth}
\noindent \begin{tikzpicture}[align=center]
\matrix[column sep=.0\w,row sep=.0\w,%
every node/.style={draw,outer sep=0},
row 1/.style={anchor=south},row 2/.style={anchor=north}]{
\node [label=above:(a)] (a) {\includegraphics[width=.14\w]{example-image-duck}}; &
\node [label=right:(d)] (d) {\includegraphics[width=.14\w,height=.14\w]{example-image-duck}};\\
\node [label=below:(b)] (b) {\includegraphics[width=.14\w]{example-image-duck}}; &
\node [label=right:(c)] (c) {\includegraphics[width=.14\w,height=.14\w]{example-image-duck}};\\};
\end{tikzpicture}%
\end{document}
あなたのグラフィック ファイルは持っていないので、いくつかの標準ファイルを使用しますが、実際の高さは異なっており、問題をシミュレートします。
付録: キー入力を少し減らすことができます
\setkeys{Gin}{width=.14\w}
それ以降、このグループに含まれるすべてのグラフィックスの幅はこの幅になります。nodes
は の省略形でありevery node/.append style
、 が このマトリックスのみで構成されている限りnode distance=0 and 0,
、何の効果もありません。,xshift=-.048\w
tikzpicture
\documentclass[journal=aamick]{achemso}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\title{hi}
\begin{document}
\maketitle
\newlength{\w}
\setlength{\w}{.9\paperwidth}
\noindent \begin{tikzpicture}[align=center]
\setkeys{Gin}{width=.14\w}
\matrix[column sep=.0\w,row sep=.0\w,%
nodes={draw,outer sep=0},
row 1/.style={anchor=south},row 2/.style={anchor=north}]{
\node [label=above:(a)] (a) {\includegraphics{example-image-duck}}; &
\node [label=right:(d)] (d) {\includegraphics[height=.14\w]{example-image-duck}};\\
\node [label=below:(b)] (b) {\includegraphics{example-image-duck}}; &
\node [label=right:(c)] (c) {\includegraphics[height=.14\w]{example-image-duck}};\\};
\end{tikzpicture}%
\end{document}