Generalsort the numbers with latex

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

sort the numbers with latex

Post by pasbal »

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:

Code: Select all

\newcount\AMCid@etud\AMCid@etud=0

Code: Select all

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

Code: Select all

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

Code: Select all

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

Code: Select all

\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

Code: Select all

\AMCqlabel{questa}, \AMCqlabel{questb}
and so on.
If i refer to many questions, i have to type

Code: Select all

\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.

Recommended reading 2024:

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

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

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

sort the numbers with latex

Post by pasbal »

Hello,

My first topic (http://latex-community.org/forum/viewto ... =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.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

sort the numbers with latex

Post by Johannes_B »

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

sort the numbers with latex

Post by pasbal »

automultiplechoice.sty
the package
(57.88 KiB) Downloaded 480 times
EMC.tex
example
(1.96 KiB) Downloaded 494 times
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

sort the numbers with latex

Post by pasbal »

the manual file is too big. You can download here :

Code: Select all

http://email.wesend.com/wf/click?upn=cFm7F9dBPd176JMbFB1jVjvUlIn829yKvg1QnOy920ZNe0HBWTslZAfnSnT1mPUUdRi4RRL9aIgGbdoC75ho2w-3D-3D_VT7h1XVDCIPdQxtnAWzTH6bx-2Bro9gPjl4Cqsu4Z97SRmXT6b2LWdAxbMvlG0oSv7gC7ewtDECfz1grBYCldhWhQ6MJhoBgrDLR0v3BJOo3eL302Yf91KzBhvjwHI0y9cezoaT6XHIOEUf3VdYmzYMeLOhUDxQEdAhCYGwIxwfMFY5nbtB2XZwJNGIZffbpUtmtj-2FZJkyKIX33gf8GabLVyaNQNS-2FjCJ2Bf1UG0PgU4g1JwbRJz9iLM7wuKenA72aTSZ6mfafyvPoHY9h4tQn4azWCh-2FPpO6QnR9Goh8zf46kNzENzZRsanWgeEH-2F8WvHFvTG1Rjs9k1jjGInjzNnAfXJjf7gFUaLDSZf88d87jiUyt-2B9vjeNMO07CnIw04c3fZ00HXCRiSgPO79rzectB69t3Hfw4NmOQhnuduRR7EFZQtyyYiPgtAV0ytKVn8BAXL2g91curUXGujN72Mxy6Q-3D-3D
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

sort the numbers with latex

Post by Johannes_B »

Package cleveref can do that in general:

Code: Select all

\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

Re: sort the numbers with latex

Post by pasbal »

Hello,

I tried with the Package cleveref but as the sheets are shuffled some errors appeared.
I already asked to the maintener but he answered the same idea as yours.

Thank a lot for help.
pasbal
Posts: 12
Joined: Thu Jun 26, 2014 10:00 pm

Re: sort the numbers with latex

Post by pasbal »

The software's maintener modified the code and the problem is fixed.
Post Reply