[OS X TeX] Search and replace in many files

Alain Schremmer schremmer.alain at gmail.com
Tue Sep 4 02:15:23 CEST 2012


On Sep 3, 2012, at 7:50 PM, Herbert Schulz wrote:

>
> On Sep 3, 2012, at 6:46 PM, Alain Schremmer  
> <schremmer.alain at gmail.com> wrote:
>
>> I hope the following is not too off topic:
>>
>> I have a "form" which gives the choice between 3 versions, Quiz,  
>> Homework, and Exam, of a "testable item":
>>
>> \ifthenelse{\boolean{Quiz?}}%
>> 	{%begin Quiz? true
>> 		Quiz version
>> 	}%end Quiz? true
>> 	{%begin Quiz false
>> 		\ifthenelse{\boolean{Homework?}}%
>> 			{%begin Homework? true
>> 				Homework version
>> 			}% end Homework? true
>> 			{%begin Homework? false
>> 				Exam version
>> 			}% end Homework? false
>> 	}% end Quiz? false
>>
>> and I always have anywhere between fifty and a hundred testable  
>> items.
>>
>> What I want to do is to have a fourth version, Workout, in other  
>> words I want to change the form to:
>>
>> \ifthenelse{\boolean{Workout?}}%
>> 	{%begin Workout? true
>> 		Workout version
>> 	}%end Workout? true
>> 	{%begin Workout false
>> 		\ifthenelse{\boolean{Quiz?}}%
>> 			{%begin Quiz? true
>> 				Quiz version
>> 			}%end Quiz? true
>> 			{%begin Quiz false
>> 				\ifthenelse{\boolean{Homework?}}%
>> 					{%begin Homework? true
>> 						Homework version
>> 					}% end Homework? true
>> 					{%begin Homework? false
>> 						Exam version
>> 					}% end Homework? false
>> 			}% end Quiz? false
>> 	}% end Workout? false
>>
>> after which I can enter the "Workout version" on each form.
>>
>> I tried to use Gerhard's GUI for sed, which I have used in the past  
>> and works very, very nicely, but, unfortunately, \r does not work  
>> in Mac's sed and I need to keep the formatting.
>>
>> Would anyone have a suggestion of what else might do the job? E.g.  
>> might there be an applescript that would work something like  
>> "Replace Text In Item Names.scpt"?
>>
>> Very hopeful regards
>> --schremmer
>
> Howdy,
>
> Are you using old style Mac line endings (MacOSRoman. Note that  
> \r=CR) for your files or more recent Unixy line endings (Unix.  
> \n=newline=LF)?

The TeXShop preference is set at old-fashioned Western (Mac OS Roman)  
but, as noted, \r does not work.

Best regards
--schremmer








More information about the macostex-archives mailing list