# [texworks] Mac OS X: request for testing

Otared Kavian otared at gmail.com
Sun Mar 6 15:09:39 CET 2016

Hi Stefan,

Thanks for the example file.
I tested the minimal TeX file you sent me. Below are some reports on the issues I observed.

• Before modifying anything, when opening a TeX file containing you example, regardless of whether one has the line

\usepackage[ngerman]{babel}

and regardless of whether there is an associated PDF file, one gets a pop up window with the error message I reported.

• Before modifying anything, the menu Scripts —> Text Transforms —> Title Case (or any other choice there) do not react and do nothing.

• After having modified the Preferences according to what you suggested, when Enable QtScript debugger is chosen, a window appears showing the error message:

Sun Mar 6 14:46:42 2016 Uncaught exception at /Users/kavian/Library/TeXworks/scripts/babelLanguage.js:41: ReferenceError: Can't find variable: target

When this window is closed after having closed the source file TeXWorks crashes… But it does not crash when one closes the debugger window before the source file, and doing this the error window

Script "Babel language": ReferenceError: Can't find variable: target

is shown again.

• When I uncheck the boxes next to Scripts > Scripting TeXworks > Manage Scripts > Hook Scripts the above mentioned behaviour does not change. By the way, there are two instances of « Babel language » under the item Hooks. Maybe one of them is spurious?

Actually I use rather TeXShop, so the behaviour I am reporting on is in order to help you, and other developpers to nail down the culprits, and moreover these buglets are not really important.

> On 06 Mar 2016, at 14:29, Stefan Löffler <st.loeffler at gmail.com> wrote:
>
> Hi Otared,
>
> On 05.03.2016 17:51, Otared Kavian wrote:
>> 1) When creating a new file, say test.tex, the error message does not appear. But when one closes test.tex and re-open it the warning:
>> 	Script "Babel language": ReferenceError: Can't find variable: target
>> appears.
>>
>
> OK. Just to be sure: this happens even if test.tex was not typeset, so there is no PDF file opening when you open the TeX, right?
> Does this message appear in the status bar or as popup dialog?
>
> A few other things to test:
> *) Do other scripts that access "target" work - such as Scripts > Text transforms > Title Case?
> *) What hook scripts are enabled (see Scripts > Scripting TeXworks > Manage Scripts > Hook Scripts). By default, this should be one "Babel language" and one "Errors, warnings, badboxes".
> *) Can you enable the script debugger under Edit > Preferences... > Scripts > Enable QtScript debugger? The next time you open a TeX file, it should fire up the debugger window. Which script is the error in (the filename should be displayed on the left)? Which line is the error in (pointed to by the arrow) and what is the command in that line? In addition, on the right side there should be a panel called "Locals". If you expand "Scope", you should find "TW". If you expand that as well, there should be "target". What's written next to it?
>
>> 2) I guess the command
>> 	\usepackage[...]{babel}
>> is specific to LaTeX, which I am not really familiar with (I am rather ConTeXt, or Plain TeX, oriented…), and I have never used with such directives: so I don’t know what should be a test file in this regard… Sorry! If you have a test file with or without such a command, I can test it for you if you send it to me.
>>
>
> Yes, it is indeed LaTeX. Here's a minimal working example (using German):
>
> \documentclass{article}
> \usepackage[ngerman]{babel}
> \begin{document}
> Hallo Welt
> \end{document}
>
> You can simple remove the \usepackage line for testing.
>
> Best,
> Stefan
>
> PS: If you don't need/want the script, you can disable it as described above. However, I'd very much appreciate getting to the bottom of this.