Is there a simple way to sort a comma separated list alphabetically in LaTeX? I tried to write a macro (\sortlist{World, Hello} → "Hello, World") using the l3sort documentation example but it completely failed.  \ExplSyntaxOn \def\@sortlist{} \newcommand{\sortlist}[1]{     \clist_set:Nn \l_foo_clist {#1}     \clist_sort:Nn \l_foo_clist{       \int_compare:nNnTF { ##1 } &gt; { ##2 }       { \sort_return_swapped: }       { \sort_return_same: }     }     \def\@sortlist{\l_foo_clist} } \ExplSyntaxOff   Is there something like \str_compare to make a string comparison or can l3sort actually only be used for numerical values?   Edit:  wasn't really helpful for me or rather I wasn't able to solve my problem thereby.
122801
Using receipt of "" I elaborated  the following code for my needs:  \documentclass{book}  ... \usepackage{expl3}  \begin{document}  \newcommand{\PrintAnswer}[1]{% \InputIfFileExists{#1}{\refstepcounter{subsection}}{\typeout{*** #1 not found ***}}}  \ExplSyntaxOn \cs_new:Nn\PrintAnswerList:n{   \clist_set:Nx\l_csv_clist{#1}   \clist_map_inline:Nn\l_csv_clist{     \typeout{**** Printing ##1.ans}     \ExplSyntaxOff     \PrintAnswer{##1.ans}     \ExplSyntaxOn   } } \PrintAnswerList:n{\inputfiles} \ExplSyntaxOff  \end{document}    It is intended for conditional compilation of a textbook, every chapter of which (eg, 01.tex, 02.tex) writes answers to problems to the file named after the name of the chapter source file, (eg, 01.ans, 02.ans etc). Near the end of the book these files are read in by the macro \PrintAnswer. Usually, I compile only few chapters using the following trick to keep desired chapters in \inputfiles macro:  \typein[\inputfiles]{^^JEnter filename(s) for \protect\includeonly:}   All that works fine, but I was forced to switch off experimental syntax before \PrintAnswer{##1.ans} because otherwise answer files are not processed correctly (in particular, LaTeX complains that the commands for greek letters are not defined and hyphenation is broken). Therefore my question is How can one rewrite the above code using user-level LaTeX3 commands?  I found \SplitList command in xparse package. Can it help?
2902
I am doing summer project in maths and I have to type my report. I am good with the latex I write on mathstack that I have learned through experience but when it comes to softwares, I do not know anything like those commands \begin \end does not make sense to me.   Is there any software which can automatically put these commands in, so that in b/w we can type whatever stuff we want?  Also if not, at least you guys can tell me if there is any latex software which shows the output on half of screen(right half), as I type on left half and compile, (I saw it somewhere).  Anyways, I have to download a software and will have to go through some you tube videos, so please suggest me relatively easy Latex software.  Thanks!  P.S. Please edit the tags as you wish, I did not understand many tags here.
64234
A number of related questions have already been asked about this issue:       and even    But I'm still confused by the conflicting suggestions that have been given so far. So I'm trying again.  Which should be the preferred command to produce a displayed equation in my LaTeX documents?  So far the suggestions indicate that one should use \[ ... \], maybe \begin{equation*} ... \end{equation*}, or maybe even the gather* or align* environments from amsmath.  And one should definitely avoid using either $$...$$ or the eqnarray environment.  Now I have to say that, from a language perspective, I have a strong preference for the equation* environment because it is less cryptic than the \[ ... \] notation and it is  the most accurate.  So, is it fine to use equation*? Maybe only after loading amsmath? Or should the equation/equation* environment be redefined to something else so that spacing, package support, or whatever is improved?
94993
I'm having an issue sorting data in ascending order.   Right now the sort order is: 1.0.0  10.0.0 10.0.1 11.0.0 2.0.0 2.0.1 3.0.0 3.0.1 3.1.0  What I want is: 1.0.0 2.0.0 2.0.1 3.0.0 3.0.1 3.1.0 10.0.0 10.0.1 11.0.0  How can I achieve this? The datatype can't be number or currency because of the 2 decimals, so I used text-field.
65888
I have currently the Latex code written in the .cls file to display a list of abbreviations as follows:  \newcommand\listnomenclature{Abbreviations} \usepackage{longtable}  \newcommand\listofnomenclature[2]{ \btypeout{\listnomenclature} \addtotoc{\listnomenclature}     \chapter*{\listnomenclature       \@mkboth{           \MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}} \begin{longtable}[c]{#1}#2\end{longtable}\par     \cleardoublepage }   It is used in the following way:  \listofnomenclature{ll}{ GHG     &amp;   GreenHouse Gasses \\ CoMP    &amp;   Cooperative Multi-Point \\ ITU     &amp;   International Telecommunication Union \\ }   Is it possible to modify the codes in the .cls file so that the output is sorted alphanumerically without drastically changing the way it is used?
23804
The preambles of my LaTeX documents often include many many lines of \DeclareMathOperator instructions, e.g.  \DeclareMathOperator{\Rep}{Rep} \DeclareMathOperator{\Tet}{Tet} \DeclareMathOperator{\Maps}{Maps} \DeclareMathOperator{\Diff}{Diff}   Is there a nice way to map some macro over a list, so I could do this more concisely, and with less copying and pasting when I add a new math operator?
15212
I see that you can create an ordered list using Markdown notation like the following.  1. line 1 2. line 2 3. line 3 ... N. line N   The Markdown content supports starting each line with any arbitrary number and reorders the list starting with 1. I'd like to start an ordered list with zero. My use case for zero would be in describing capture groups from regular expressions where group zero always returns the entire string. So I'd like to display something like this:  # Groups 0. Entire string 1. The first capture group you were looking for 2. The second capture group 3. The third group with the string I heart Kittens   Markdown instead reorders the group and forces the ordered list to start at 1:    Trying to force the issue with inline HTML: &lt;ol start="0"&gt; or &lt;ol&gt;&lt;li value="0"&gt;entire string&lt;/li&gt;&lt;/ol&gt; doesn't work either. Any ideas on how I can create ordered list starting with zero?  If it's not possible to do so, then this is a feature-request.
61134
Code: \documentclass{article} \usepackage[a5paper]{geometry} \usepackage{multicol} \setlength{\parindent}{0cm} \begin{document} \begin{multicols}{2}   \begin{enumerate}   \item text 1   \item text 2   \item text 3   \item text 4   \item text 5   \end{enumerate} \end{multicols} \end{document}  Gives this:  How to move &quot;text 5&quot; upwards adjacent to &quot;text 4&quot;?
84276
I'm looking for a simple, easy to understand algorithm to alphabetically sort an array of characters in C.
87065
I'm looking for some sample code that will sort the list items in an HTML list by alphabetical order.  Can anyone help?  Here is a sample list for people to work with:  &lt;ul class="alphaList"&gt;     &lt;li&gt;apples&lt;/li&gt;     &lt;li&gt;cats&lt;/li&gt;     &lt;li&gt;bears&lt;/li&gt; &lt;/ul&gt;
83783
$ sort -t $'\t' -k 1rn,1 -k 2,2rn -k 3f,4 listaprezzi  2050        900           bananas     5 1905        700           grapes      17 250         4000          oranges     10 230         9200          figs        4 220         5000          lemons      10 200         8000          pears       8   I want to sort 1st column of listaprezzi numerically in reverse (option rn), 2nd also rn, and third alphabetically (f). What is the correct command?  I've tried many ways but having no success.
57185
I want to split a character string n by n. I know how to do that 1 by 1 :  \documentclass{article} \makeatletter  \def\s@plit&lt;#1#2&gt;{%   \ifx\empty#2%     #1%   \else     #1,\s@plit&lt;#2&gt;%   \fi}  \def\Split#1#2{\s@plit&lt;#2\empty&gt;} \makeatother  \begin{document} \Split{1}{123456789} \end{document}   It gives : 1,2,3,4,5,6,7,8,9  But I also want 1,23,45,67,89 or 123,456,789 ... depending from the first parameter.  EDIT  Work straight and reverse, even with foreach.        \documentclass{article}     \usepackage{tikz,xparse,xstring}  \DeclareDocumentCommand{\split}{smmo}{%     \xdef\Entree{#3}%     \let\Sortie\empty%     \IfBooleanTF #1     {% sans étoile         \loop         \StrRight{\Entree}{#2}[\tmp]%         \edef\Sortie{\Sortie,\tmp}%         \StrGobbleRight{\Entree}{#2}[\Entree]%         \unless\ifx\Entree\empty         \repeat         \StrGobbleLeft{\Sortie}{1}[\Sortie]%     }     {% avec étoile dans l'ordre inverse         \loop         \StrRight{\Entree}{#2}[\tmp]%         \edef\Sortie{\tmp,\Sortie}%         \StrGobbleRight{\Entree}{#2}[\Entree]%         \unless\ifx\Entree\empty         \repeat         \StrGobbleRight{\Sortie}{1}[\Sortie]%     }     \IfNoValueTF{#4}{\Sortie}{\edef#4{\Sortie}}     }  \begin{document} \split{2}{6513782}  \split*{2}{6513782}  \split*{2}{6513782}[\bob]  \foreach \x in \bob {[\x] }  \end{document}
118809
I've got two columns of data I need to sort: the first column(A) needs to be sorted lexicographically and for any rows which then contain the same column A string, I need them to be sorted numerically according to what's in the second column(B).   I was thinking    'sort -f' , but that would make a '12' in column B come before a '2'.   Edit: Accidentally typed column in place of row.
69577
I am trying to output a list of stockists in two columns from left to right, sorted alphabetically:  A | B  C | D  E | F  G | H  Currently, the code below is sorting half the posts alphabeticly and then starting half way through with the rest alphabeticly:  A | C  E | G  B | D  F | H  Any idea on where I am going wrong?  &lt;?php  query_posts(  array( 'order' =&gt; 'ASC' , 'orderby' =&gt; 'title' , 'posts_per_page' =&gt; -1 , 'post_type' =&gt; 'stockist_directory', 'regions' =&gt; 'metropolitan' ) ); if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) == 0) : $wp_query-&gt;next_post(); else : the_post(); ?&gt;  &lt;div id="left-column"&gt; &lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;   &lt;?php the_field('shop_address'); ?&gt;&lt;br/&gt;   &lt;?php the_field('suburb'); ?&gt;, &lt;?php the_field('postcode'); ?&gt;&lt;br/&gt;   Phone: &lt;?php the_field('phone_number'); ?&gt;&lt;br/&gt;   &lt;a href="&lt;?php the_field('website_address'); ?&gt;"&gt;Website&lt;/a&gt; &lt;/div&gt;  &lt;?php endif; endwhile; else: ?&gt; &lt;?php endif; ?&gt;  &lt;?php $i = 0; rewind_posts(); ?&gt;  &lt;?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) !== 0) : $wp_query-&gt;next_post(); else : the_post(); ?&gt;  &lt;div id="right-column"&gt;  &lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;   &lt;?php the_field('shop_address'); ?&gt;&lt;br/&gt;   &lt;?php the_field('suburb'); ?&gt;, &lt;?php the_field('postcode'); ?&gt;&lt;br/&gt;   Phone: &lt;?php the_field('phone_number'); ?&gt;&lt;br/&gt;   &lt;a href="&lt;?php the_field('website_address'); ?&gt;"&gt;Website&lt;/a&gt;   &lt;/div&gt; &lt;?php endif; endwhile; else: ?&gt;  &lt;?php endif; ?&gt;
122147
I am trying to code a command in LaTeX to type the . You can see in the Wikipedia link above that these are rather simple tables. There is a vertical line at the beginning, after the first column, and there is a horizontal line at the end, before the last row.   I would like to have a command that I can pass the numerical entries of the table and ir draw the rest.   How to do this?  I would like something like \ruffini{...} and in entries we either enter the list of numbers, perhaps separated by commas. Or maybe even entering the numbers with the separators &amp; and \\ to format in what position the go in the table. But I wouldn't want to be thinking about the lines in the table. I would like the command to take care of the line.
89074
It seems that a common operation needed when defining new commands is to scan over a list of arguments (separated e.g. by a comma, but maybe by something else) and do something with each argument in the list, find the last one, or whatever.  For example to write commands that look like \Command{a,b,c} or \Command{c.d.e} and do something with each a, b, and c. See e.g. questions on  and .  Some solutions have been posted there, but what would be the best idiom to perform such kind of operations? LaTeX's \@for looks very nice, but is it possible to use it to scan anything other than comma-separated lists?
46372
I'm looking for an algorithm that sorts strings similar to the way files (and folders) are sorted in Windows Explorer. It seems that numeric values in strings are taken into account when sorted which results in something like  name 1, name 2, name 10   instead of  name 1, name 10, name 2   which you get with a regular string comparison.  I was about to start writing this myself but wanted to check if anyone had done this before and was willing to share some code or insights. The way I would approach this would be to add leading zeros to the numeric values in the name before comparing them. This would result in something like  name 00001, name 00010, name 00002   which when sorted with a regular string sort would give me the correct result.  Any ideas?