## LaTeX forum ⇒ General ⇒ sort the numbers with latex Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
pasbal
Posts: 12
Joined: Thu Jun 26, 2014 10:00 pm

### sort the numbers with latex

First, forgive my faults in English. The text is translated by Google. Secondly, I am new on latex and i have no knowledge on programmation.
I use a free software to test my pupils. (here the link http://home.gna.org/auto-qcm/).

The author modified some instructions and created some news:
\newcount\AMCid@etud\AMCid@etud=0

\def\AMClabel#1{\expandafter\label{\the\AMCid@etud-#1}}

\def\AMCref#1{\expandafter\ref{\the\AMCid@etud-#1}}

\def\AMCpageref#1{\expandafter\pageref{\the\AMCid@etud-#1}}

\newcommand{\AMCqlabel}[1]{%\protected@write\@auxout{}{\string\newlabel{\the\AMCid@etud-#1}{{\arabic{AMCquestionaff}}{\thepage}}}%

The software may create many exams sheets in random order.

When i want to label a question, i type
\AMCqlabel{questa}, \AMCqlabel{questb}
and so on.
If i refer to many questions, i have to type
\AMCref{questa},\AMCref{questb} or \AMCpageref{questa}

But, the question's number and page are not sorted in ascending order. The questions are shuffled.
I asked the author a solution and he advised me to load the package cleveref but it does not work.

So, do you have an idea to sort the numbers with latex.

Thanks et regards.

Tags:

pasbal
Posts: 12
Joined: Thu Jun 26, 2014 10:00 pm
Hello,

My first topic (http://latex-community.org/forum/viewtopic.php?f=5&t=24918) seems difficult to resolve (Is there a code, macro in latex language to sort the number ?).
So, I change my way of thinking and i will try something different.

I noticed the labels was writen in a file (*.aux). Is it possible to open this file and search some words or character then copy and paste them in the file *.tex (as the package xstring do it) ?

Thanks for help.

Johannes_B
Site Moderator
Posts: 4103
Joined: Thu Nov 01, 2012 4:08 pm
One reason i didn't answer your previous post was a lack of time on the one hand and utter confusion on the other. Preparing a minimal working example helps us to understand the problem.

All files written and read are simple text files. You can open them with any texteditor (notepad, gedit, mousepad).
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

pasbal
Posts: 12
Joined: Thu Jun 26, 2014 10:00 pm
automultiplechoice.sty
the package
EMC.tex
example
Hello,

Find an example.

Thanks for help.

i can't attach more one file, i will attach the AMC package file and the manual in other posts.
Last edited by pasbal on Thu Aug 07, 2014 12:35 pm, edited 1 time in total.

pasbal
Posts: 12
Joined: Thu Jun 26, 2014 10:00 pm

http://email.wesend.com/wf/click?upn=cFm7F9dBPd176JMbFB1jVjvUlIn829yKvg1QnOy920ZNe0HBWTslZAfnSnT1mPUUdRi4RRL9aIgGbdoC75ho2w-3D-3D_VT7h1XVDCIPdQxtnAWzTH6bx-2Bro9gPjl4Cqsu4Z97SRmXT6b2LWdAxbMvlG0oSv7gC7ewtDECfz1grBYCldhWhQ6MJhoBgrDLR0v3BJOo3eL302Yf91KzBhvjwHI0y9cezoaT6XHIOEUf3VdYmzYMeLOhUDxQEdAhCYGwIxwfMFY5nbtB2XZwJNGIZffbpUtmtj-2FZJkyKIX33gf8GabLVyaNQNS-2FjCJ2Bf1UG0PgU4g1JwbRJz9iLM7wuKenA72aTSZ6mfafyvPoHY9h4tQn4azWCh-2FPpO6QnR9Goh8zf46kNzENzZRsanWgeEH-2F8WvHFvTG1Rjs9k1jjGInjzNnAfXJjf7gFUaLDSZf88d87jiUyt-2B9vjeNMO07CnIw04c3fZ00HXCRiSgPO79rzectB69t3Hfw4NmOQhnuduRR7EFZQtyyYiPgtAV0ytKVn8BAXL2g91curUXGujN72Mxy6Q-3D-3D

Johannes_B
Site Moderator
Posts: 4103
Joined: Thu Nov 01, 2012 4:08 pm
Package cleveref can do that in general:
\documentclass{article}\usepackage{cleveref} \begin{document}\section{}\label{A}\section{}\label{B}\section{}\label{C}\cref{B,C,A}\end{document}

With your package, a lot of commands are introduced because different shuffled worksheets are output. One would need to redefine the internals of the package and i think the maintainer should do so.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

pasbal
Posts: 12
Joined: Thu Jun 26, 2014 10:00 pm
Hello,

I tried with the Package cleveref but as the sheets are shuffled some errors appeared.

Thank a lot for help.

pasbal
Posts: 12
Joined: Thu Jun 26, 2014 10:00 pm
The software's maintener modified the code and the problem is fixed.