하위 그림이 너무 많고, pylatex의 카운터가 너무 큽니다.

하위 그림이 너무 많고, pylatex의 카운터가 너무 큽니다.

를 사용하여 26개 이상의 하위 그림이 있는 그림을 만들려고 합니다 pylatex. 나는 다음과 같은 다른 게시물을 통해 이해합니다.카운터가 너무 깁니다.일반 LaTeX 편집기에서 이 문제를 해결하는 방법은 서문에 다음을 추가하는 것입니다.

\usepackage{alphalph}
\renewcommand\thesubfigure{\alphalph{\value{subfigure}}

pylatex그러나 이러한 수정 사항을 어떻게 구현하는지 , 아니면 이것이 올바른 방법인지 잘 모르겠습니다 .

내 코드는 현재 다음과 같습니다.

from pylatex import Document, Section, Subsection, Figure, SubFigure, NoEscape, Command, Package
from pathlib import Path
if __name__ == '__main__':
    with doc.create(Section('Clustering results')):
        doc.append('These are all the images from the PPP-static run')
    # We need to iterate across the cluster_list 
    # Enumerate seems to be a convenient way of keeping count of iterations
        for cluster_number in cluster_list:
            # The first for loop goes through the total number of clusters e.g. 0-23
            # For each cluster number, define a figure
            with doc.create(Subsection('Cluster %s.' % cluster_number)):
                doc.append('These are the images in %s:' % cluster_number)

                with doc.create(Figure(position='htbp')) as fig:
                    for index, row in df_affinity.iterrows():
                        if cluster_number == row["Clustering Labels"]: 
                                print ("yay")
                                image_name= str(row["label"])
                                file_location = str("./pppstatic/PPP_Static_200_PX/")
                                image_location = file_location + image_name
                                img_path = Path(image_location)
                                with doc.create(SubFigure(position="htbp")) as pic:
                                    pic.add_image(image_location)
                                    pic.add_caption("%s." % image_name)
doc.generate_pdf(clean_tex=False)

관련 정보