Re: [PATCH 2/2] runlatex.sh: Fix while loop condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

On 2016/04/22 06:34 -0700, Paul E. McKenney wrote:
> On Fri, Apr 22, 2016 at 09:58:24PM +0900, Akira Yokosawa wrote:
>> On 2016/04/22 16:54 -0700, Paul E. McKenney wrote:

Oh, I miss-converted the date. This should have been "On 2016/04/21 16:54 -0700."

>> [snip]
>>
>>>> Can you try this one?
>>>> Thanks, Akira
>>>
>>> I did, though for some reason I had to hand-apply it on my test branch.
>>> Not sure what "git apply" didn't like.
>>
>> Well, I'm afraid you tried to apply it after [PATCH 2/2] applied.
>> I should have made it clear it was a diff from master at that moment.
>> Sorry for your trouble.
> 
> I am pretty sure that I was applying it to the current master,
> but I cannot prove anything at this point.  ;-)
> 
>>> It does repeat upon undefined, which is good.  Nicer behavior after
>>> bibliography changes!
>>>
>>> There is another "Fatal latex error" earlier that I missed, and it would
>>> be good to have an "exit 1" on that one as well.
>>>
>>> The one thing I am still concerned about is a real undefined reference,
>>> which would consume a full five iterations.  Not really sure what would
>>> be improved behavior, though.  Thoughts?
>>>
>>> 							Thanx, Paul
>>
>> So your question is why you need to change the maximum value from 4 to 5,
>> isn't it?  That's because the count is checked at the end of the loop,
>> and even when the 4th round of pdflatex is successful, the check will
>> fire and 'make' will regard it as an error. At such a later stage, 
>> remaining warning should only be 'LaTeX Warning: Label(s) may have changed',
>> if any.
> 
> Yes, I do understand that.  Your (very welcome!) changes to the quick-quiz
> links can require additional passes through latex.  Therefore, the script
> should change to provide this.
> 
> To see what I am getting at, please add a "\ref{this is a typo}" or a
> reference to any other non-\label string, then type "make".  This is a
> pure error that no number of reruns will fix, but the build script will
> nevertheless crank away multiple times.
> 
> Before, it would run bibtex and stop.  (Which, I freely admit, wasn't
> particularly good behavior either!)
> 
> My question is whether it is possible to make the script let the user
> know why it is re-running latex, so that the user can choose to kill
> it early, if appropriate.  Or, alternatively (and for extra credit!),
> recognize which labels are undefined, and do more passes if they are
> quick-quiz links.
>

I see. I'll try to add those features and improve the behavior. I'm not sure
how far I can do, but please wait for a while. And thank you so much for
your valuable suggestions.

                                                      Regards, Akira

>> So I made a fairly invasive modification to the script so that the count
>> is checked at the beginning of the loop. Also the loop is separated for each
>> of the warning message.
>>
>> Appended is the whole source code of the script (without the comment part at
>> the head). I'm not sure which point should I make a diff from. Note that
>> I truncated the warning messages given to grep. They should be long enough.
> 
> Good idea!
> 
>> What do you think?
> 
> Please see below.
> 
> 							Thanx, Paul
> 
>> If it is OK, I'll resubmit the V2 of the patch series relative to the
>> current master.
>>
>>                                                        Thanks, Akira.
>>
>> --- 
>> #!/bin/sh
>> # [snip]
>> #
>>
>> if test -z "$1"
>> then
>> 	echo No latex file, aborting.
>> 	exit 1
>> fi
>>
>> basename=`echo $1 | sed -e 's/\.tex$//'`
>>
>> iter=1
>> echo "pdflatex $iter"
>> pdflatex $basename > /dev/null 2>&1 < /dev/null || :
>> if grep -q '! Emergency stop.' $basename.log
>> then
>> 	echo "----- Fatal latex error, see $basename.log for details. -----"
> 
> Please add "exit 1" here.  (Yes, this was a bug in my orignal.  But as
> long as we are here...)
> 
>> fi
>> if grep -q 'LaTeX Warning: There were undefined references' $basename.log
>> then
>> 	if test -d "$2"
>> 	then
>> 		bibtex $basename || :
>> 	else
>> 		echo "No bibliography directory, skipping bibtex."
>> 	fi
>> fi
>> while grep -q 'LaTeX Warning: There were undefined references' $basename.log
>> do
>> 	if test "$iter" -eq 4
>> 	then
>> 		echo "Iteration limit: $iter passes through pdflatex"
>> 		exit 1
>> 	fi
>> 	iter=`expr $iter + 1`
> 
> This would be one point to add some indication of why we are doing
> another pass through the loop.  Might be as simple as adding "Undefined
> references" to the "echo" below.  Or maybe even show the last symbol
> listed as undefined.
> 
>> 	echo "pdflatex $iter"
>> 	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
>> 	if grep -q '! Emergency stop.' $basename.log
>> 	then
>> 		echo "----- Fatal latex error, see $basename.log for details. -----"
>> 		exit 1
>> 	fi
>> done
>> while grep -q 'LaTeX Warning: Label(s) may have changed' $basename.log
>> do
>> 	if test "$iter" -ge 4
>> 	then
>> 		echo "Iteration limit: $iter passes through pdflatex"
>> 		exit 1
>> 	fi
>> 	iter=`expr $iter + 1`
> 
> This would be one point to add some indication of why we are doing
> another pass through the loop.  Might be as simple as adding "Label(s)
> may have changed" to the "echo" below.
> 
>> 	echo "pdflatex $iter"
>> 	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
>> 	if grep -q '! Emergency stop.' $basename.log
>> 	then
>> 		echo "----- Fatal latex error, see $basename.log for details. -----"
>> 		exit 1
>> 	fi
>> done
>> grep "LaTeX Warning:" $basename.log
>> exit 0
>>
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux