
我有一個表,其中有幾列
|Col. A|...|...|Col. B|...|Col. C|...|
我想列印該表 3 次,一次根據 A 列、B 列、C 列排序。但 nomencl 也應該可以實現,因為 nomencl 對列表進行排序。
我的最小例子:
\begin{tabular}{|c|c|c|c|c|c|c|c|} \\
... & HZL & Unicode & Name & ...& ...& ...& ... \\
... & 124 & 1279F & GER & ..& ...& ...& ... \\
... & 113 & 1259F & mur & ...& ...& ...& ... \\
\end{tabular}
HZL=Col.A,Unicode=Col.B,名稱=Col.C
由於這是在赫梯庫斯的框架內進行的,因此每週新增標誌時都必須對表格進行排序。表格環境其實是較長表格(longtabular 或 supertabular)的環境。我正在使用 XeTex。我想要的是這樣的:
\def\tabentry124{... & 124 & 1279F & GER & ..& ...& ...& ... \\}
\def\tabeentry113{... & 113 & 1259F & mur & ...& ...& ...& ... \\}
\begin{tabular}
\tabentry113
\tabentry124
\end{tabular}
這段程式碼甚至可以為我節省一個排序過程,因為條目已經根據 HZL 編號進行排序。
預先感謝您的任何想法!
安吉莉卡
答案1
這是一個關於如何使用pgfplotstable
對錶進行排序的小範例:
\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableset{col sep=semicolon, string type}
\pgfplotstableread
{
HZL;Unicode;Name
124;1279F ;GER
113;1259F ;mu
}\loadedtable
sort by "HZL" column:
\pgfplotstabletypeset[sort,sort cmp={int <},sort key=HZL]\loadedtable
\bigskip
sort by "Unicode" column:
\pgfplotstabletypeset[sort,sort cmp={string <},sort key=Unicode]\loadedtable
\bigskip
sort by "Name" column:
\pgfplotstabletypeset[sort,sort cmp={string <},sort key=Name]\loadedtable
\end{document}