Is it possible to force a package to be called last in the entirety of the LaTeX, when called in the class file? The 2019 Stack Overflow Developer Survey Results Are InProblem adding pdfpages to current class and/or tex filePackage options and RequirePackage: order of commands and option conflicts?LaTeX Error: File `knitting.sty' not found - cannot get knitting package to runLocal package inside other local packageApplying options to already loaded packageIs there a way to find out which packages are used (rather than merely called) by a document?How do I install LaTeX package on-the-fly on Mac?Modular LaTeX document preambles and class filesPossible LaTeX package to maintain simultaneous text translationsUnstable page numbering in aaltothesis class?

Is flight data recorder erased after every flight?

Is an up-to-date browser secure on an out-of-date OS?

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?

Where to refill my bottle in India?

Did Section 31 appear in Star Trek: The Next Generation?

Deal with toxic manager when you can't quit

Why is the maximum length of OpenWrt’s root password 8 characters?

Is there a symbol for a right arrow with a square in the middle?

Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?

I see my dog run

Can you compress metal and what would be the consequences?

What is the accessibility of a package's `Private` context variables?

Geography at the pixel level

How to support a colleague who finds meetings extremely tiring?

Is a "Democratic" Oligarchy-Style System Possible?

One word riddle: Vowel in the middle

Right tool to dig six foot holes?

Apparent duplicates between Haynes service instructions and MOT

Statement true because not provable

Output the Arecibo Message

Is this app Icon Browser Safe/Legit?

Identify This Plant (Flower)

What is the meaning of the verb "bear" in this context?



Is it possible to force a package to be called last in the entirety of the LaTeX, when called in the class file?



The 2019 Stack Overflow Developer Survey Results Are InProblem adding pdfpages to current class and/or tex filePackage options and RequirePackage: order of commands and option conflicts?LaTeX Error: File `knitting.sty' not found - cannot get knitting package to runLocal package inside other local packageApplying options to already loaded packageIs there a way to find out which packages are used (rather than merely called) by a document?How do I install LaTeX package on-the-fly on Mac?Modular LaTeX document preambles and class filesPossible LaTeX package to maintain simultaneous text translationsUnstable page numbering in aaltothesis class?










5















I have designed a class that needs the xepersian package. This package is unique in the way that it needs to be called last so it doesn't get overwritten. I usually define my packages in the class file using the "RequirePackage".
Is there a way to force a package to be called last where it is called in the .cls file with the possibility of other packages being called using the usepackage in the .tex file?










share|improve this question






















  • You can use AtBeginDocumentRequirePackagexepersian.

    – Phelype Oleinik
    11 hours ago











  • @PhelypeOleinik I see. Thanks.

    – Al_Fh
    11 hours ago






  • 2





    @campa AfterEndPreamble is too late to load a package. You'll get a LaTeX Error: Can be used only in preamble.. The AtBeginDocument is the latest a package can be loaded because right after that the preamble ends (i.e. preamble-only commands become error messages).

    – Phelype Oleinik
    11 hours ago






  • 4





    @PhelypeOleinik assuming that none of the packages you load later use the same trick to delay some package loading ...

    – Ulrike Fischer
    11 hours ago











  • @UlrikeFischer Ah, yes, there's that. If I recall correctly, there's an infamous Brazilian class file which does something like that and loading hyperref on top of it is a nightmare :-)

    – Phelype Oleinik
    11 hours ago















5















I have designed a class that needs the xepersian package. This package is unique in the way that it needs to be called last so it doesn't get overwritten. I usually define my packages in the class file using the "RequirePackage".
Is there a way to force a package to be called last where it is called in the .cls file with the possibility of other packages being called using the usepackage in the .tex file?










share|improve this question






















  • You can use AtBeginDocumentRequirePackagexepersian.

    – Phelype Oleinik
    11 hours ago











  • @PhelypeOleinik I see. Thanks.

    – Al_Fh
    11 hours ago






  • 2





    @campa AfterEndPreamble is too late to load a package. You'll get a LaTeX Error: Can be used only in preamble.. The AtBeginDocument is the latest a package can be loaded because right after that the preamble ends (i.e. preamble-only commands become error messages).

    – Phelype Oleinik
    11 hours ago






  • 4





    @PhelypeOleinik assuming that none of the packages you load later use the same trick to delay some package loading ...

    – Ulrike Fischer
    11 hours ago











  • @UlrikeFischer Ah, yes, there's that. If I recall correctly, there's an infamous Brazilian class file which does something like that and loading hyperref on top of it is a nightmare :-)

    – Phelype Oleinik
    11 hours ago













5












5








5








I have designed a class that needs the xepersian package. This package is unique in the way that it needs to be called last so it doesn't get overwritten. I usually define my packages in the class file using the "RequirePackage".
Is there a way to force a package to be called last where it is called in the .cls file with the possibility of other packages being called using the usepackage in the .tex file?










share|improve this question














I have designed a class that needs the xepersian package. This package is unique in the way that it needs to be called last so it doesn't get overwritten. I usually define my packages in the class file using the "RequirePackage".
Is there a way to force a package to be called last where it is called in the .cls file with the possibility of other packages being called using the usepackage in the .tex file?







xetex packages






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 11 hours ago









Al_FhAl_Fh

826




826












  • You can use AtBeginDocumentRequirePackagexepersian.

    – Phelype Oleinik
    11 hours ago











  • @PhelypeOleinik I see. Thanks.

    – Al_Fh
    11 hours ago






  • 2





    @campa AfterEndPreamble is too late to load a package. You'll get a LaTeX Error: Can be used only in preamble.. The AtBeginDocument is the latest a package can be loaded because right after that the preamble ends (i.e. preamble-only commands become error messages).

    – Phelype Oleinik
    11 hours ago






  • 4





    @PhelypeOleinik assuming that none of the packages you load later use the same trick to delay some package loading ...

    – Ulrike Fischer
    11 hours ago











  • @UlrikeFischer Ah, yes, there's that. If I recall correctly, there's an infamous Brazilian class file which does something like that and loading hyperref on top of it is a nightmare :-)

    – Phelype Oleinik
    11 hours ago

















  • You can use AtBeginDocumentRequirePackagexepersian.

    – Phelype Oleinik
    11 hours ago











  • @PhelypeOleinik I see. Thanks.

    – Al_Fh
    11 hours ago






  • 2





    @campa AfterEndPreamble is too late to load a package. You'll get a LaTeX Error: Can be used only in preamble.. The AtBeginDocument is the latest a package can be loaded because right after that the preamble ends (i.e. preamble-only commands become error messages).

    – Phelype Oleinik
    11 hours ago






  • 4





    @PhelypeOleinik assuming that none of the packages you load later use the same trick to delay some package loading ...

    – Ulrike Fischer
    11 hours ago











  • @UlrikeFischer Ah, yes, there's that. If I recall correctly, there's an infamous Brazilian class file which does something like that and loading hyperref on top of it is a nightmare :-)

    – Phelype Oleinik
    11 hours ago
















You can use AtBeginDocumentRequirePackagexepersian.

– Phelype Oleinik
11 hours ago





You can use AtBeginDocumentRequirePackagexepersian.

– Phelype Oleinik
11 hours ago













@PhelypeOleinik I see. Thanks.

– Al_Fh
11 hours ago





@PhelypeOleinik I see. Thanks.

– Al_Fh
11 hours ago




2




2





@campa AfterEndPreamble is too late to load a package. You'll get a LaTeX Error: Can be used only in preamble.. The AtBeginDocument is the latest a package can be loaded because right after that the preamble ends (i.e. preamble-only commands become error messages).

– Phelype Oleinik
11 hours ago





@campa AfterEndPreamble is too late to load a package. You'll get a LaTeX Error: Can be used only in preamble.. The AtBeginDocument is the latest a package can be loaded because right after that the preamble ends (i.e. preamble-only commands become error messages).

– Phelype Oleinik
11 hours ago




4




4





@PhelypeOleinik assuming that none of the packages you load later use the same trick to delay some package loading ...

– Ulrike Fischer
11 hours ago





@PhelypeOleinik assuming that none of the packages you load later use the same trick to delay some package loading ...

– Ulrike Fischer
11 hours ago













@UlrikeFischer Ah, yes, there's that. If I recall correctly, there's an infamous Brazilian class file which does something like that and loading hyperref on top of it is a nightmare :-)

– Phelype Oleinik
11 hours ago





@UlrikeFischer Ah, yes, there's that. If I recall correctly, there's an infamous Brazilian class file which does something like that and loading hyperref on top of it is a nightmare :-)

– Phelype Oleinik
11 hours ago










1 Answer
1






active

oldest

votes


















9














You can delay the package loading using AtBeginDocument:



AtBeginDocumentRequirePackagexepersian


this will put the package loading after the .aux file is read but before the “proper end” of the preamble, where all the preamble-only commands are redefined to throw an error; from this point on any usepackage (or RequirePackage) will not work.



If the package, for some reason, needs to be loaded before the begindocument even starts, then you can load the etoolbox package and use:



BeforeBeginEnvironmentdocumentRequirePackagexepersian


this will execute the RequirePackage before executing anything from the begindocument. The effect is the same as if you had put the RequirePackage line right before begindocument in your .tex file.






share|improve this answer

























  • What do you mean by the "proper end" of the preamble? Can you clarify?

    – Al_Fh
    11 hours ago











  • @Al_Fh I just invented that name :P I clarified the answer.

    – Phelype Oleinik
    11 hours ago











  • Thank you very much.

    – Al_Fh
    11 hours ago











  • Of course, you can always load xpersian in the preamble (before hyperref). It will not be loaded twice.

    – John Kormylo
    6 hours ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f484102%2fis-it-possible-to-force-a-package-to-be-called-last-in-the-entirety-of-the-latex%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









9














You can delay the package loading using AtBeginDocument:



AtBeginDocumentRequirePackagexepersian


this will put the package loading after the .aux file is read but before the “proper end” of the preamble, where all the preamble-only commands are redefined to throw an error; from this point on any usepackage (or RequirePackage) will not work.



If the package, for some reason, needs to be loaded before the begindocument even starts, then you can load the etoolbox package and use:



BeforeBeginEnvironmentdocumentRequirePackagexepersian


this will execute the RequirePackage before executing anything from the begindocument. The effect is the same as if you had put the RequirePackage line right before begindocument in your .tex file.






share|improve this answer

























  • What do you mean by the "proper end" of the preamble? Can you clarify?

    – Al_Fh
    11 hours ago











  • @Al_Fh I just invented that name :P I clarified the answer.

    – Phelype Oleinik
    11 hours ago











  • Thank you very much.

    – Al_Fh
    11 hours ago











  • Of course, you can always load xpersian in the preamble (before hyperref). It will not be loaded twice.

    – John Kormylo
    6 hours ago















9














You can delay the package loading using AtBeginDocument:



AtBeginDocumentRequirePackagexepersian


this will put the package loading after the .aux file is read but before the “proper end” of the preamble, where all the preamble-only commands are redefined to throw an error; from this point on any usepackage (or RequirePackage) will not work.



If the package, for some reason, needs to be loaded before the begindocument even starts, then you can load the etoolbox package and use:



BeforeBeginEnvironmentdocumentRequirePackagexepersian


this will execute the RequirePackage before executing anything from the begindocument. The effect is the same as if you had put the RequirePackage line right before begindocument in your .tex file.






share|improve this answer

























  • What do you mean by the "proper end" of the preamble? Can you clarify?

    – Al_Fh
    11 hours ago











  • @Al_Fh I just invented that name :P I clarified the answer.

    – Phelype Oleinik
    11 hours ago











  • Thank you very much.

    – Al_Fh
    11 hours ago











  • Of course, you can always load xpersian in the preamble (before hyperref). It will not be loaded twice.

    – John Kormylo
    6 hours ago













9












9








9







You can delay the package loading using AtBeginDocument:



AtBeginDocumentRequirePackagexepersian


this will put the package loading after the .aux file is read but before the “proper end” of the preamble, where all the preamble-only commands are redefined to throw an error; from this point on any usepackage (or RequirePackage) will not work.



If the package, for some reason, needs to be loaded before the begindocument even starts, then you can load the etoolbox package and use:



BeforeBeginEnvironmentdocumentRequirePackagexepersian


this will execute the RequirePackage before executing anything from the begindocument. The effect is the same as if you had put the RequirePackage line right before begindocument in your .tex file.






share|improve this answer















You can delay the package loading using AtBeginDocument:



AtBeginDocumentRequirePackagexepersian


this will put the package loading after the .aux file is read but before the “proper end” of the preamble, where all the preamble-only commands are redefined to throw an error; from this point on any usepackage (or RequirePackage) will not work.



If the package, for some reason, needs to be loaded before the begindocument even starts, then you can load the etoolbox package and use:



BeforeBeginEnvironmentdocumentRequirePackagexepersian


this will execute the RequirePackage before executing anything from the begindocument. The effect is the same as if you had put the RequirePackage line right before begindocument in your .tex file.







share|improve this answer














share|improve this answer



share|improve this answer








edited 11 hours ago

























answered 11 hours ago









Phelype OleinikPhelype Oleinik

25k54690




25k54690












  • What do you mean by the "proper end" of the preamble? Can you clarify?

    – Al_Fh
    11 hours ago











  • @Al_Fh I just invented that name :P I clarified the answer.

    – Phelype Oleinik
    11 hours ago











  • Thank you very much.

    – Al_Fh
    11 hours ago











  • Of course, you can always load xpersian in the preamble (before hyperref). It will not be loaded twice.

    – John Kormylo
    6 hours ago

















  • What do you mean by the "proper end" of the preamble? Can you clarify?

    – Al_Fh
    11 hours ago











  • @Al_Fh I just invented that name :P I clarified the answer.

    – Phelype Oleinik
    11 hours ago











  • Thank you very much.

    – Al_Fh
    11 hours ago











  • Of course, you can always load xpersian in the preamble (before hyperref). It will not be loaded twice.

    – John Kormylo
    6 hours ago
















What do you mean by the "proper end" of the preamble? Can you clarify?

– Al_Fh
11 hours ago





What do you mean by the "proper end" of the preamble? Can you clarify?

– Al_Fh
11 hours ago













@Al_Fh I just invented that name :P I clarified the answer.

– Phelype Oleinik
11 hours ago





@Al_Fh I just invented that name :P I clarified the answer.

– Phelype Oleinik
11 hours ago













Thank you very much.

– Al_Fh
11 hours ago





Thank you very much.

– Al_Fh
11 hours ago













Of course, you can always load xpersian in the preamble (before hyperref). It will not be loaded twice.

– John Kormylo
6 hours ago





Of course, you can always load xpersian in the preamble (before hyperref). It will not be loaded twice.

– John Kormylo
6 hours ago

















draft saved

draft discarded
















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f484102%2fis-it-possible-to-force-a-package-to-be-called-last-in-the-entirety-of-the-latex%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Category:Fedor von Bock Media in category "Fedor von Bock"Navigation menuUpload mediaISNI: 0000 0000 5511 3417VIAF ID: 24712551GND ID: 119294796Library of Congress authority ID: n96068363BnF ID: 12534305fSUDOC authorities ID: 034604189Open Library ID: OL338253ANKCR AUT ID: jn19990000869National Library of Israel ID: 000514068National Thesaurus for Author Names ID: 341574317ReasonatorScholiaStatistics

Reverse int within the 32-bit signed integer range: [−2^31, 2^31 − 1]Combining two 32-bit integers into one 64-bit integerDetermine if an int is within rangeLossy packing 32 bit integer to 16 bitComputing the square root of a 64-bit integerKeeping integer addition within boundsSafe multiplication of two 64-bit signed integersLeetcode 10: Regular Expression MatchingSigned integer-to-ascii x86_64 assembler macroReverse the digits of an Integer“Add two numbers given in reverse order from a linked list”

Kiel Indholdsfortegnelse Historie | Transport og færgeforbindelser | Sejlsport og anden sport | Kultur | Kendte personer fra Kiel | Noter | Litteratur | Eksterne henvisninger | Navigationsmenuwww.kiel.de54°19′31″N 10°8′26″Ø / 54.32528°N 10.14056°Ø / 54.32528; 10.14056Oberbürgermeister Dr. Ulf Kämpferwww.statistik-nord.deDen danske Stats StatistikKiels hjemmesiderrrWorldCat312794080n790547494030481-4