Switching lines in preamble causes error/NO error












2















I have 2 almost idenctical lines of LaTeX source.
They differ only in switching order of these two lines



usepackage[fleqn]{amsmath}

usepackage{amsmath,amssymb}


One causes error and the other one compiles. WHY?



NO ERROR:



documentclass{article}
usepackage[fleqn]{amsmath}


usepackage{amsmath,amssymb}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


ERROR:



documentclass{article}


usepackage{amsmath,amssymb}
usepackage[fleqn]{amsmath}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


The second source causes this error:



Command Line:   bibtex.exe "ideje10"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit)
The top-level auxiliary file: ideje10.aux
I found no citation commands---while reading file ideje10.aux
I found no bibdata command---while reading file ideje10.aux
I found no bibstyle command---while reading file ideje10.aux
(There were 3 error messages)


Command Line: makeindex.exe "ideje10.idx"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is makeindex, version 2.15 [MiKTeX 2.9 64-bit] (kpathsea + Thai support).
Scanning style file ./ideje10.mst...done (3 attributes redefined, 0 ignored).
Scanning input file ideje10.idx....done (2 entries accepted, 0 rejected).
Sorting entries....done (2 comparisons).
Generating output file ideje10.ind....done (7 lines written, 0 warnings).
Output written in ideje10.ind.
Transcript written in ideje10.ilg.


Command Line: pdflatex.exe --interaction=errorstopmode --synctex=-1 "C:Usershynek0DesktopTH0diplideje10.tex"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9 64-bit)
entering extended mode
(C:/Users/hynek0/Desktop/TH0dipl/ideje10.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
(D:ProgramFilesMikTexExetexlatexbasearticle.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(D:ProgramFilesMikTexExetexlatexbasesize10.clo))
(D:ProgramFilesMikTexExetexlatexamsmathamsmath.sty
For additional information on amsmath, use the `?' option.
(D:ProgramFilesMikTexExetexlatexamsmathamstext.sty
(D:ProgramFilesMikTexExetexlatexamsmathamsgen.sty))
(D:ProgramFilesMikTexExetexlatexamsmathamsbsy.sty)
(D:ProgramFilesMikTexExetexlatexamsmathamsopn.sty))
(D:ProgramFilesMikTexExetexlatexamsfontsamssymb.sty
(D:ProgramFilesMikTexExetexlatexamsfontsamsfonts.sty))

! LaTeX Error: Option clash for package amsmath.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.6

?

! Emergency stop.
...

l.6


Process has been killed ...



===========================================
I can of course switch the lines to get a compiling code, but I'm curious why this happens.










share|improve this question




















  • 2





    You should not load the same package multiple times, especially not with different options.

    – samcarter
    Jan 23 at 9:39








  • 3





    In the second code, you first load amsmath without any option, then you load it with an option. Never do that! Also, why loading a package twice?

    – Bernard
    Jan 23 at 9:39
















2















I have 2 almost idenctical lines of LaTeX source.
They differ only in switching order of these two lines



usepackage[fleqn]{amsmath}

usepackage{amsmath,amssymb}


One causes error and the other one compiles. WHY?



NO ERROR:



documentclass{article}
usepackage[fleqn]{amsmath}


usepackage{amsmath,amssymb}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


ERROR:



documentclass{article}


usepackage{amsmath,amssymb}
usepackage[fleqn]{amsmath}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


The second source causes this error:



Command Line:   bibtex.exe "ideje10"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit)
The top-level auxiliary file: ideje10.aux
I found no citation commands---while reading file ideje10.aux
I found no bibdata command---while reading file ideje10.aux
I found no bibstyle command---while reading file ideje10.aux
(There were 3 error messages)


Command Line: makeindex.exe "ideje10.idx"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is makeindex, version 2.15 [MiKTeX 2.9 64-bit] (kpathsea + Thai support).
Scanning style file ./ideje10.mst...done (3 attributes redefined, 0 ignored).
Scanning input file ideje10.idx....done (2 entries accepted, 0 rejected).
Sorting entries....done (2 comparisons).
Generating output file ideje10.ind....done (7 lines written, 0 warnings).
Output written in ideje10.ind.
Transcript written in ideje10.ilg.


Command Line: pdflatex.exe --interaction=errorstopmode --synctex=-1 "C:Usershynek0DesktopTH0diplideje10.tex"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9 64-bit)
entering extended mode
(C:/Users/hynek0/Desktop/TH0dipl/ideje10.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
(D:ProgramFilesMikTexExetexlatexbasearticle.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(D:ProgramFilesMikTexExetexlatexbasesize10.clo))
(D:ProgramFilesMikTexExetexlatexamsmathamsmath.sty
For additional information on amsmath, use the `?' option.
(D:ProgramFilesMikTexExetexlatexamsmathamstext.sty
(D:ProgramFilesMikTexExetexlatexamsmathamsgen.sty))
(D:ProgramFilesMikTexExetexlatexamsmathamsbsy.sty)
(D:ProgramFilesMikTexExetexlatexamsmathamsopn.sty))
(D:ProgramFilesMikTexExetexlatexamsfontsamssymb.sty
(D:ProgramFilesMikTexExetexlatexamsfontsamsfonts.sty))

! LaTeX Error: Option clash for package amsmath.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.6

?

! Emergency stop.
...

l.6


Process has been killed ...



===========================================
I can of course switch the lines to get a compiling code, but I'm curious why this happens.










share|improve this question




















  • 2





    You should not load the same package multiple times, especially not with different options.

    – samcarter
    Jan 23 at 9:39








  • 3





    In the second code, you first load amsmath without any option, then you load it with an option. Never do that! Also, why loading a package twice?

    – Bernard
    Jan 23 at 9:39














2












2








2








I have 2 almost idenctical lines of LaTeX source.
They differ only in switching order of these two lines



usepackage[fleqn]{amsmath}

usepackage{amsmath,amssymb}


One causes error and the other one compiles. WHY?



NO ERROR:



documentclass{article}
usepackage[fleqn]{amsmath}


usepackage{amsmath,amssymb}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


ERROR:



documentclass{article}


usepackage{amsmath,amssymb}
usepackage[fleqn]{amsmath}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


The second source causes this error:



Command Line:   bibtex.exe "ideje10"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit)
The top-level auxiliary file: ideje10.aux
I found no citation commands---while reading file ideje10.aux
I found no bibdata command---while reading file ideje10.aux
I found no bibstyle command---while reading file ideje10.aux
(There were 3 error messages)


Command Line: makeindex.exe "ideje10.idx"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is makeindex, version 2.15 [MiKTeX 2.9 64-bit] (kpathsea + Thai support).
Scanning style file ./ideje10.mst...done (3 attributes redefined, 0 ignored).
Scanning input file ideje10.idx....done (2 entries accepted, 0 rejected).
Sorting entries....done (2 comparisons).
Generating output file ideje10.ind....done (7 lines written, 0 warnings).
Output written in ideje10.ind.
Transcript written in ideje10.ilg.


Command Line: pdflatex.exe --interaction=errorstopmode --synctex=-1 "C:Usershynek0DesktopTH0diplideje10.tex"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9 64-bit)
entering extended mode
(C:/Users/hynek0/Desktop/TH0dipl/ideje10.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
(D:ProgramFilesMikTexExetexlatexbasearticle.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(D:ProgramFilesMikTexExetexlatexbasesize10.clo))
(D:ProgramFilesMikTexExetexlatexamsmathamsmath.sty
For additional information on amsmath, use the `?' option.
(D:ProgramFilesMikTexExetexlatexamsmathamstext.sty
(D:ProgramFilesMikTexExetexlatexamsmathamsgen.sty))
(D:ProgramFilesMikTexExetexlatexamsmathamsbsy.sty)
(D:ProgramFilesMikTexExetexlatexamsmathamsopn.sty))
(D:ProgramFilesMikTexExetexlatexamsfontsamssymb.sty
(D:ProgramFilesMikTexExetexlatexamsfontsamsfonts.sty))

! LaTeX Error: Option clash for package amsmath.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.6

?

! Emergency stop.
...

l.6


Process has been killed ...



===========================================
I can of course switch the lines to get a compiling code, but I'm curious why this happens.










share|improve this question
















I have 2 almost idenctical lines of LaTeX source.
They differ only in switching order of these two lines



usepackage[fleqn]{amsmath}

usepackage{amsmath,amssymb}


One causes error and the other one compiles. WHY?



NO ERROR:



documentclass{article}
usepackage[fleqn]{amsmath}


usepackage{amsmath,amssymb}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


ERROR:



documentclass{article}


usepackage{amsmath,amssymb}
usepackage[fleqn]{amsmath}


usepackage{imakeidx}

makeindex

begin{document}

Some text

index{Apple}index{Apricot}

printindex

end{document}


The second source causes this error:



Command Line:   bibtex.exe "ideje10"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit)
The top-level auxiliary file: ideje10.aux
I found no citation commands---while reading file ideje10.aux
I found no bibdata command---while reading file ideje10.aux
I found no bibstyle command---while reading file ideje10.aux
(There were 3 error messages)


Command Line: makeindex.exe "ideje10.idx"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is makeindex, version 2.15 [MiKTeX 2.9 64-bit] (kpathsea + Thai support).
Scanning style file ./ideje10.mst...done (3 attributes redefined, 0 ignored).
Scanning input file ideje10.idx....done (2 entries accepted, 0 rejected).
Sorting entries....done (2 comparisons).
Generating output file ideje10.ind....done (7 lines written, 0 warnings).
Output written in ideje10.ind.
Transcript written in ideje10.ilg.


Command Line: pdflatex.exe --interaction=errorstopmode --synctex=-1 "C:Usershynek0DesktopTH0diplideje10.tex"
Startup Folder: C:Usershynek0DesktopTH0dipl

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9 64-bit)
entering extended mode
(C:/Users/hynek0/Desktop/TH0dipl/ideje10.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
(D:ProgramFilesMikTexExetexlatexbasearticle.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(D:ProgramFilesMikTexExetexlatexbasesize10.clo))
(D:ProgramFilesMikTexExetexlatexamsmathamsmath.sty
For additional information on amsmath, use the `?' option.
(D:ProgramFilesMikTexExetexlatexamsmathamstext.sty
(D:ProgramFilesMikTexExetexlatexamsmathamsgen.sty))
(D:ProgramFilesMikTexExetexlatexamsmathamsbsy.sty)
(D:ProgramFilesMikTexExetexlatexamsmathamsopn.sty))
(D:ProgramFilesMikTexExetexlatexamsfontsamssymb.sty
(D:ProgramFilesMikTexExetexlatexamsfontsamsfonts.sty))

! LaTeX Error: Option clash for package amsmath.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.6

?

! Emergency stop.
...

l.6


Process has been killed ...



===========================================
I can of course switch the lines to get a compiling code, but I'm curious why this happens.







incompatibility package-options compilation-error






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 23 at 10:50









Ari Brodsky

1,4241230




1,4241230










asked Jan 23 at 9:35









user2925716user2925716

1645




1645








  • 2





    You should not load the same package multiple times, especially not with different options.

    – samcarter
    Jan 23 at 9:39








  • 3





    In the second code, you first load amsmath without any option, then you load it with an option. Never do that! Also, why loading a package twice?

    – Bernard
    Jan 23 at 9:39














  • 2





    You should not load the same package multiple times, especially not with different options.

    – samcarter
    Jan 23 at 9:39








  • 3





    In the second code, you first load amsmath without any option, then you load it with an option. Never do that! Also, why loading a package twice?

    – Bernard
    Jan 23 at 9:39








2




2





You should not load the same package multiple times, especially not with different options.

– samcarter
Jan 23 at 9:39







You should not load the same package multiple times, especially not with different options.

– samcarter
Jan 23 at 9:39






3




3





In the second code, you first load amsmath without any option, then you load it with an option. Never do that! Also, why loading a package twice?

– Bernard
Jan 23 at 9:39





In the second code, you first load amsmath without any option, then you load it with an option. Never do that! Also, why loading a package twice?

– Bernard
Jan 23 at 9:39










1 Answer
1






active

oldest

votes


















8














From the documentation of usepackage in source2e.pdf:




usepackage[⟨package-option-list ⟩]{⟨package-list ⟩}[⟨version ⟩]



There
can be any number of these declarations. All packages in
⟨package-list⟩ are called with the same options. [...]



Each
package is loaded only once. If the same package is requested more
than once, nothing happens, unless the package has been requested with
options that were not given the first time it was loaded, in which
case an error is produced.




In your second example you load amsmath with the option fleqn that was not given the first time, so you get an error ("option clash"). In general each package should only be loaded once.






share|improve this answer























    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%2f471436%2fswitching-lines-in-preamble-causes-error-no-error%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









    8














    From the documentation of usepackage in source2e.pdf:




    usepackage[⟨package-option-list ⟩]{⟨package-list ⟩}[⟨version ⟩]



    There
    can be any number of these declarations. All packages in
    ⟨package-list⟩ are called with the same options. [...]



    Each
    package is loaded only once. If the same package is requested more
    than once, nothing happens, unless the package has been requested with
    options that were not given the first time it was loaded, in which
    case an error is produced.




    In your second example you load amsmath with the option fleqn that was not given the first time, so you get an error ("option clash"). In general each package should only be loaded once.






    share|improve this answer




























      8














      From the documentation of usepackage in source2e.pdf:




      usepackage[⟨package-option-list ⟩]{⟨package-list ⟩}[⟨version ⟩]



      There
      can be any number of these declarations. All packages in
      ⟨package-list⟩ are called with the same options. [...]



      Each
      package is loaded only once. If the same package is requested more
      than once, nothing happens, unless the package has been requested with
      options that were not given the first time it was loaded, in which
      case an error is produced.




      In your second example you load amsmath with the option fleqn that was not given the first time, so you get an error ("option clash"). In general each package should only be loaded once.






      share|improve this answer


























        8












        8








        8







        From the documentation of usepackage in source2e.pdf:




        usepackage[⟨package-option-list ⟩]{⟨package-list ⟩}[⟨version ⟩]



        There
        can be any number of these declarations. All packages in
        ⟨package-list⟩ are called with the same options. [...]



        Each
        package is loaded only once. If the same package is requested more
        than once, nothing happens, unless the package has been requested with
        options that were not given the first time it was loaded, in which
        case an error is produced.




        In your second example you load amsmath with the option fleqn that was not given the first time, so you get an error ("option clash"). In general each package should only be loaded once.






        share|improve this answer













        From the documentation of usepackage in source2e.pdf:




        usepackage[⟨package-option-list ⟩]{⟨package-list ⟩}[⟨version ⟩]



        There
        can be any number of these declarations. All packages in
        ⟨package-list⟩ are called with the same options. [...]



        Each
        package is loaded only once. If the same package is requested more
        than once, nothing happens, unless the package has been requested with
        options that were not given the first time it was loaded, in which
        case an error is produced.




        In your second example you load amsmath with the option fleqn that was not given the first time, so you get an error ("option clash"). In general each package should only be loaded once.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 23 at 9:53









        Andrew SwannAndrew Swann

        77.3k9130330




        77.3k9130330






























            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%2f471436%2fswitching-lines-in-preamble-causes-error-no-error%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

            Mario Kart Wii

            The Binding of Isaac: Rebirth/Afterbirth

            What does “Dominus providebit” mean?