子圖太多,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)

相關內容