
높이가 다른 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}
그 이후로 이 그룹에 포함된 그래픽의 모든 너비는 이 너비를 갖게 됩니다. Also 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}