GeneralAlphabetic order of text in Table

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
msaeed
Posts: 3
Joined: Mon Mar 17, 2008 10:09 am

Alphabetic order of text in Table

Post by msaeed »

Respected ALL:

Can anybody tell me please, that how we can automatically generate the text in alphabetic order in Latex Table?

Regards
Saeed

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Re: Alphabetic order of text in Table

Post by Juanjo »

Could you explain what you understand by "LaTeX table"? Are you writing a tabular environment? Has it text in one column and you want to sort rows alphabetically by that column? If this were the case, to my knowledge, LaTeX itself does not provide any sorting macro. You should do it before.
msaeed
Posts: 3
Joined: Mon Mar 17, 2008 10:09 am

Re: Alphabetic order of text in Table

Post by msaeed »

yes I am using the tabular environment. I have four column and twenty rows. Now if I want to add a new row then 1st I add this new row in Microsoft Excel file, then sort it alphabetically and then add it to the tabular environment. And then I have to change the numbering of all the following entries. now if I have to add another row then again I have to repeat the procedure. SO I want to ask is there any automatic way of sorting alphabetically the text in tabular environment.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Alphabetic order of text in Table

Post by Juanjo »

As I said before, there is no LaTeX macro to sort rows in a tabular environment. However, if the problem is the numbering of rows, perhaps that could be done automatically. If you are interested, you should provide a minimal example and additional explanations, if needed, of what you are doing.
msaeed
Posts: 3
Joined: Mon Mar 17, 2008 10:09 am

Re: Alphabetic order of text in Table

Post by msaeed »

Respected:
1st of all I am grateful to you for your effort.
I have attached the sample file(All the names are dummy), if you will create its pdf/dvi file then it will be helpful to understand the scenario.
The problem is if I want to add two names "Baqi" and "Bekhud" (agains thses two names are also dummy), then 1st I made it in Microsoft Excel file, then sort it alphabetically and then I have to make the *.tex file agian. and for every entry I have to repeat the process. If I could do numbering the automatically and automatic sorting in Tabular environment then it would be very helpful for me.
Thanking in anticipation.
Attachments
minimal example.tex
(801 Bytes) Downloaded 674 times
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Alphabetic order of text in Table

Post by Juanjo »

Add this to the preamble:

Code: Select all

\newcounter{SingleNo}\newcounter{DoubleNo}
\newcommand{\SingleSerialNo}{\stepcounter{SingleNo}\theSingleNo}
\newcommand{\DoubleSerialNo}{\stepcounter{DoubleNo}\theDoubleNo}
Then, you can replace every entry in the first column by \SingleSerialNo, and every one in the third column, by \DoubleSerialNo. Numbering will be done automatically
Post Reply