그리드와 같은 tikz 그림의 확장 문제

그리드와 같은 tikz 그림의 확장 문제

내 목표는 영화 시퀀스의 많은 사진이 있고 이를 내림차순으로 조판하는 프로세스를 자동화하는 것입니다. 이를 위해 내 모든 이미지는 폴더에 보관되며 물론 끝에 파일 인덱스로 이름이 지정됩니다. 나는 a를 선택했지만 matrix유연성이 있는 한(3가지 매개변수 기준: 총 너비, 소형 너비, 열 수) 어떤 제품이든 tikz훌륭할 것입니다.

% !TeX encoding = UTF-8
% !TeX spellcheck = fr_FR

\documentclass[11pt, frenchb, twoside]{report}

% IMPORTS

\usepackage{polyglossia}
\usepackage{xparse}
\usepackage{xifthen}

\usepackage{tikz}
\usetikzlibrary{backgrounds, patterns, shapes,
                calc, positioning, 
                matrix, scopes,
                decorations.fractals, decorations.text}

\newlength{\foolen}
\newlength{\barlen}

% GRIDFIGURES % % % % % % % % % % % % % % % %
% #1 total width [default: \textwidth]
% #2 total figures
% #3 total columns
% #4 gutter space
% #5 folder
% #6 label
\ProvideDocumentCommand \gridFigures{ O{\textwidth} m m m m m }
{%
    \let\gridcontent\empty
    \let\ea\expandafter%

    \pgfmathsetlength{\foolen}{(#1/#3)-#4}
    \pgfdeclareimage[width=\foolen]{ghost}{../assets/#5/#6-1}
    \settoheight{\barlen}{\pgfuseimage{ghost}}
%
    \foreach \i in {1,2,...,#2}
    {%
        \pgfmathparse{mod(\i,#3)}
        \pgfmathtruncatemacro{\mod}{\pgfmathresult}
        \ifthenelse{\mod>0}
            {\ea\gappto\ea\gridcontent\ea{\ea{\i} \&}}
            {\ea\gappto\ea\gridcontent\ea{something \ea{\i} \\}}}

    \begin{tikzpicture}
        \matrix[matrix of nodes, ampersand replacement=\&]{\gridcontent};
    \end{tikzpicture}}

\begin{document}
\begin{figure}[ht]
    \gridFigures{40}{5}{5mm}{mohr}{cubic-limit}
\end{figure}
\end{document}

왜냐하면 지금은 확장 문제로 인해 이미지 번호로 행렬을 채울 수 없기 때문입니다. \i에서 파일 인덱스( )를 사용하여 이미지를 다시 빌드하려면 바로 확장해야 합니다. \foreach그렇지 않으면 작동하지 않습니다. 실제로 확장이 무엇인지 이해하기 시작한 것은 처음이므로 뭔가 빠졌을 것입니다.i\ea\gappto\ea\gridcontent\ea

답변1

\documentclass{article}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, matrix, scopes}

\tikzset{nosep/.style={inner sep=0pt,outer sep=0pt}}

% GRIDFIGURES % % % % % % % % % % % % % % % %
% #1 total width [default: \textwidth]
% #2 macro for matrix content
% #3 total figures
% #4 total columns
% #5 gutter space
% #6 folder
% #7 label
\ExplSyntaxOn
\ProvideDocumentCommand \gridFigures{ O{\textwidth} m m m m m m }
{%
    \tl_clear_new:N #2
    \dim_new:N \l_width_dim

    \pgfmathparse{#3-1}
    \pgfmathtruncatemacro{\row}{\pgfmathresult}
    \pgfmathsetlength{\l_width_dim}{(#1/#4)-#5}

    \int_step_inline:nnnn {1}{#4}{\row}
    {
        \pgfmathparse{##1+#4-1}
        \pgfmathtruncatemacro{\col}{\pgfmathresult}

        \int_step_inline:nnnn {##1}{1}{\col}
        {
            \tl_put_right:Nn #2 {\includegraphics[width=\l_width_dim]{#6/#7-####1}}
            \int_compare:nT {####1<\col}
                {\tl_put_right:Nn #2 {\&}}
        }
        \tl_put_right:Nn #2 {\\}
    }
}
\ExplSyntaxOff
\begin{document}
\gridFigures{\matrixContent}{40}{5}{2mm}{../assets/mohr}{cubic-limit}
\begin{tikzpicture}[nosep]
    \matrix[matrix of nodes,ampersand replacement=\&,
            column sep=2mm,row sep=2mm]{\matrixContent};
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보