<div dir="ltr"><div>Thanks Reinhard,</div><div><br></div><div>Generally these special comments or so-called  <i>magic comments</i>,  are in the TeXworks manual already (<font size="2"><span style="font-weight:normal">under <u>5.2 Special comment strings</u></span></font><font size="2">

</font>), and there is a thread covering the jobname thing here...</div><div><br></div><div>
<div class="gmail-comment-text gmail-js-comment-text-and-form">
            <div class="gmail-comment-body gmail-js-comment-edit-hide" style="margin-left:40px">
                
                <span class="gmail-comment-copy"><a href="https://tex.stackexchange.com/questions/289152/defining-the-pdf-output-file-within-the-document-file-using-job-name">https://tex.stackexchange.com/questions/289152/defining-the-pdf-output-file-within-the-document-file-using-job-name</a></span></div><div class="gmail-comment-body gmail-js-comment-edit-hide" style="margin-left:40px"><span class="gmail-comment-copy"><br></span></div><div class="gmail-comment-body gmail-js-comment-edit-hide" style="margin-left:40px"><span class="gmail-comment-copy">The line <code>%& -jobname=myName</code> is one of these so-called <i>magic comments</i>, which can be interpreted by <i>some editors</i> (TeXstudio, TeXworks).  This is hence not an intrinsic feature of <code>pdftex</code> and compiling from the command line will thus result in those magic comments being ignored.</span>
                
                    – <a href="https://tex.stackexchange.com/users/10995/henri-menke" title="80,680 reputation" class="gmail-comment-user">Henri Menke</a>
                <span class="gmail-comment-date" dir="ltr"><a class="gmail-comment-link" href="https://tex.stackexchange.com/questions/289152/defining-the-pdf-output-file-within-the-document-file-using-job-name#comment700037_289152"><span title="2016-01-25 12:21:28Z" class="gmail-relativetime-clean">Jan 25 '16 at 12:21</span></a></span>
                        <span title="this comment was edited 1 time">
                            </span></div></div><li id="gmail-comment-700037" class="gmail-comment gmail-js-comment" style="margin-left:40px"><div class="gmail-comment-text gmail-js-comment-text-and-form"><div class="gmail-comment-body gmail-js-comment-edit-hide"><span title="this comment was edited 1 time">
                        </span>
                                                            </div>
        </div>
    <br></li><div style="margin-left:40px">
    </div><li id="gmail-comment-700086" class="gmail-comment gmail-js-comment" style="margin-left:40px">
        <div class="gmail-js-comment-actions gmail-comment-actions">
            <div class="gmail-comment-score gmail-js-comment-edit-hide">
            </div>
                    </div>
        <div class="gmail-comment-text gmail-js-comment-text-and-form">
            <div class="gmail-comment-body gmail-js-comment-edit-hide">
                
                <span class="gmail-comment-copy">@HenriMenke No, this is a 
magic line for the TeX engine and is not interpreted by editors, <i>as far 
as I know</i>. Some implementations of TeX allow <code>-jobname</code> there some don't: MiKTeX does, TeX Live doesn't.</span>
                
                    – <a href="https://tex.stackexchange.com/users/4427/egreg" title="754,212 reputation" class="gmail-comment-user">egreg</a>
                <span class="gmail-comment-date" dir="ltr"><a class="gmail-comment-link" href="https://tex.stackexchange.com/questions/289152/defining-the-pdf-output-file-within-the-document-file-using-job-name#comment700086_289152"><span title="2016-01-25 14:52:15Z" class="gmail-relativetime-clean">Jan </span></a></span></div></div></li></div><div><br></div><div>Its useful for example when you are using this package 


<p style="margin:0px 0px 0px 40px;text-indent:0px;white-space:pre-wrap"><span style="font-family:courier new,monospace">\usepackage[1-9,18-24,131-136,401, 429-431]{<b>pagesel</b>}</span></p><p style="margin:0px 0px 0px 40px;text-indent:0px;white-space:pre-wrap"><span style="font-family:courier new,monospace"><br></span></p><p style="margin:0px;text-indent:0px;white-space:pre-wrap">Allowing you to output selected page ranges - while retaining internal linking and bookmarks, unlike package <span style="font-family:courier new,monospace">pdfpages</span> which can extract page ranges from an existing .pdf, but tends not to maintain internal links.</p><p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p><p style="margin:0px;text-indent:0px;white-space:pre-wrap">So being able to reset the out put pdf  document name on a need by need basis, allows for getting out the page range selection you want, under a new output name, that does not interfere with the existing already rendered full document, and the links work within the page range rendered using 
<span style="font-family:courier new,monospace"><b>pagesel</b></span>
<br></p><p style="margin:0px;text-indent:0px;white-space:pre-wrap">So I was just looking for the correct form to use (under MiKTEx) from within TeXworks.</p><p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p><p style="margin:0px;text-indent:0px;white-space:pre-wrap">Kind regards,</p><p style="margin:0px;text-indent:0px;white-space:pre-wrap">Paul<br></p>

</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 13 Jul 2019 at 16:01, Reinhard Kotucha <<a href="mailto:reinhard.kotucha@web.de">reinhard.kotucha@web.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2019-07-12 at 12:53:31 +1200, Paul A Norman wrote:<br>
<br>
 > HI,<br>
 ><br>
 > Does TeXworks have an undocumented special comment string for<br>
 > something like:<br>
 ><br>
 > % !TeX job-name = "Some Other Name"<br>
<br>
Presumably not.  What exactly do you want to achieve?  IMO opinion<br>
a text editor is the worst place for such nasty things.<br>
<br>
There are certainly better solutions which don't depend on a<br>
particular text editor.  But we have to know exactly what you want to<br>
achieve.<br>
<br>
Regards,<br>
  Reinhard<br>
<br>
--<br>
------------------------------------------------------------------<br>
Reinhard Kotucha                            Phone: +49-511-3373112<br>
Marschnerstr. 25<br>
D-30167 Hannover                    mailto:<a href="mailto:reinhard.kotucha@web.de" target="_blank">reinhard.kotucha@web.de</a><br>
------------------------------------------------------------------<br>
</blockquote></div>