Error: Argument of newcommand{…} has an extra }












1














I am trying to create a new command to help formatting the entries of the list of figures. Argument 1 should be optional and contain the date the source was accessed, argument 2 is simply the figure's caption I want to show up in the list of figures, and argument 3 is a hyperlink to the source of the image. I want the source and date to only show up in the list of figures and not underneath the actual image. I wrote this in the preamble:



newcommand{lof}[3]{
textbf{#2}
linebreak
{scriptsize #3 #1}
}


This is the caption of some figure:



caption[
lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
]
{Basic neural network with three layers}


Note that I want to be able to declare that the image is my own, in which case the hyperlink and the date should be omitted.



caption[
{Basic neural network with three layers}
{Made by the author.}
]
{Basic neural network with three layers}


This gives me the following error:



! Argument of \lof has an extra }.


However, the brackets should be balanced if I am not completely mistaken. I have read somewhere that there are 'fragile' commands, and using them leads to the same error message I got. Might url{} be a fragile command? Or have I messed up the command definition somehow?



Edit:



The following code shows everything that might be related to the problem. If I remove these parts from the code, the LaTeX documents compiles.



documentclass{article}
usepackage{wrapfig,graphicx,amsmath,hyperref}

newcommand{lof}[3]{textbf{#2}newline {scriptsize #3 #1}}
begin{document}

listoffigures

begin{wrapfigure}{r}{0.25textwidth}
centering
includegraphics[width=0.25textwidth]{example-image}
caption[ {lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ]
{Basic neural network with three layers}
label{fig:nn}
end{wrapfigure}

begin{wrapfigure}{h}{0.5textwidth}
centering
includegraphics[width=0.5textwidth]{example-image}
caption[{lof{$boldsymbol{sigma (x)}$, the sigmoid function}
{Created by the author}}]
{$sigma (x)$, the sigmoid function}
label{fig:sigmoid}
end{wrapfigure}

end{document}









share|improve this question









New contributor




Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    caption[ {lof[(Accessed on 02.01.2019)] {Basic neural network with three layers} {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ] {Basic neural network with three layers} -- you must enclose the lot[...]{}{} command with a {} pair, since it has an optional argument and occurs in the optional argument of caption
    – Christian Hupfer
    2 hours ago








  • 1




    You might want to have a look at the xparse package, which makes it considerably easier to define commands with multiple optonal arguments.
    – GuM
    2 hours ago






  • 1




    @Terrenay: Then add the complete code, not just fragments only
    – Christian Hupfer
    2 hours ago






  • 1




    As you are new, I extended your fragment with the missing definitions and replacing with generally available images, however it does not produce the error that you are asking about. Please edit the example so that it is an example of the error.
    – David Carlisle
    2 hours ago






  • 1




    also you should delete your .aux and .lof files which may be corrupted by previous errors.
    – David Carlisle
    2 hours ago


















1














I am trying to create a new command to help formatting the entries of the list of figures. Argument 1 should be optional and contain the date the source was accessed, argument 2 is simply the figure's caption I want to show up in the list of figures, and argument 3 is a hyperlink to the source of the image. I want the source and date to only show up in the list of figures and not underneath the actual image. I wrote this in the preamble:



newcommand{lof}[3]{
textbf{#2}
linebreak
{scriptsize #3 #1}
}


This is the caption of some figure:



caption[
lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
]
{Basic neural network with three layers}


Note that I want to be able to declare that the image is my own, in which case the hyperlink and the date should be omitted.



caption[
{Basic neural network with three layers}
{Made by the author.}
]
{Basic neural network with three layers}


This gives me the following error:



! Argument of \lof has an extra }.


However, the brackets should be balanced if I am not completely mistaken. I have read somewhere that there are 'fragile' commands, and using them leads to the same error message I got. Might url{} be a fragile command? Or have I messed up the command definition somehow?



Edit:



The following code shows everything that might be related to the problem. If I remove these parts from the code, the LaTeX documents compiles.



documentclass{article}
usepackage{wrapfig,graphicx,amsmath,hyperref}

newcommand{lof}[3]{textbf{#2}newline {scriptsize #3 #1}}
begin{document}

listoffigures

begin{wrapfigure}{r}{0.25textwidth}
centering
includegraphics[width=0.25textwidth]{example-image}
caption[ {lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ]
{Basic neural network with three layers}
label{fig:nn}
end{wrapfigure}

begin{wrapfigure}{h}{0.5textwidth}
centering
includegraphics[width=0.5textwidth]{example-image}
caption[{lof{$boldsymbol{sigma (x)}$, the sigmoid function}
{Created by the author}}]
{$sigma (x)$, the sigmoid function}
label{fig:sigmoid}
end{wrapfigure}

end{document}









share|improve this question









New contributor




Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    caption[ {lof[(Accessed on 02.01.2019)] {Basic neural network with three layers} {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ] {Basic neural network with three layers} -- you must enclose the lot[...]{}{} command with a {} pair, since it has an optional argument and occurs in the optional argument of caption
    – Christian Hupfer
    2 hours ago








  • 1




    You might want to have a look at the xparse package, which makes it considerably easier to define commands with multiple optonal arguments.
    – GuM
    2 hours ago






  • 1




    @Terrenay: Then add the complete code, not just fragments only
    – Christian Hupfer
    2 hours ago






  • 1




    As you are new, I extended your fragment with the missing definitions and replacing with generally available images, however it does not produce the error that you are asking about. Please edit the example so that it is an example of the error.
    – David Carlisle
    2 hours ago






  • 1




    also you should delete your .aux and .lof files which may be corrupted by previous errors.
    – David Carlisle
    2 hours ago
















1












1








1







I am trying to create a new command to help formatting the entries of the list of figures. Argument 1 should be optional and contain the date the source was accessed, argument 2 is simply the figure's caption I want to show up in the list of figures, and argument 3 is a hyperlink to the source of the image. I want the source and date to only show up in the list of figures and not underneath the actual image. I wrote this in the preamble:



newcommand{lof}[3]{
textbf{#2}
linebreak
{scriptsize #3 #1}
}


This is the caption of some figure:



caption[
lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
]
{Basic neural network with three layers}


Note that I want to be able to declare that the image is my own, in which case the hyperlink and the date should be omitted.



caption[
{Basic neural network with three layers}
{Made by the author.}
]
{Basic neural network with three layers}


This gives me the following error:



! Argument of \lof has an extra }.


However, the brackets should be balanced if I am not completely mistaken. I have read somewhere that there are 'fragile' commands, and using them leads to the same error message I got. Might url{} be a fragile command? Or have I messed up the command definition somehow?



Edit:



The following code shows everything that might be related to the problem. If I remove these parts from the code, the LaTeX documents compiles.



documentclass{article}
usepackage{wrapfig,graphicx,amsmath,hyperref}

newcommand{lof}[3]{textbf{#2}newline {scriptsize #3 #1}}
begin{document}

listoffigures

begin{wrapfigure}{r}{0.25textwidth}
centering
includegraphics[width=0.25textwidth]{example-image}
caption[ {lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ]
{Basic neural network with three layers}
label{fig:nn}
end{wrapfigure}

begin{wrapfigure}{h}{0.5textwidth}
centering
includegraphics[width=0.5textwidth]{example-image}
caption[{lof{$boldsymbol{sigma (x)}$, the sigmoid function}
{Created by the author}}]
{$sigma (x)$, the sigmoid function}
label{fig:sigmoid}
end{wrapfigure}

end{document}









share|improve this question









New contributor




Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am trying to create a new command to help formatting the entries of the list of figures. Argument 1 should be optional and contain the date the source was accessed, argument 2 is simply the figure's caption I want to show up in the list of figures, and argument 3 is a hyperlink to the source of the image. I want the source and date to only show up in the list of figures and not underneath the actual image. I wrote this in the preamble:



newcommand{lof}[3]{
textbf{#2}
linebreak
{scriptsize #3 #1}
}


This is the caption of some figure:



caption[
lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
]
{Basic neural network with three layers}


Note that I want to be able to declare that the image is my own, in which case the hyperlink and the date should be omitted.



caption[
{Basic neural network with three layers}
{Made by the author.}
]
{Basic neural network with three layers}


This gives me the following error:



! Argument of \lof has an extra }.


However, the brackets should be balanced if I am not completely mistaken. I have read somewhere that there are 'fragile' commands, and using them leads to the same error message I got. Might url{} be a fragile command? Or have I messed up the command definition somehow?



Edit:



The following code shows everything that might be related to the problem. If I remove these parts from the code, the LaTeX documents compiles.



documentclass{article}
usepackage{wrapfig,graphicx,amsmath,hyperref}

newcommand{lof}[3]{textbf{#2}newline {scriptsize #3 #1}}
begin{document}

listoffigures

begin{wrapfigure}{r}{0.25textwidth}
centering
includegraphics[width=0.25textwidth]{example-image}
caption[ {lof[(Accessed on 02.01.2019)]
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ]
{Basic neural network with three layers}
label{fig:nn}
end{wrapfigure}

begin{wrapfigure}{h}{0.5textwidth}
centering
includegraphics[width=0.5textwidth]{example-image}
caption[{lof{$boldsymbol{sigma (x)}$, the sigmoid function}
{Created by the author}}]
{$sigma (x)$, the sigmoid function}
label{fig:sigmoid}
end{wrapfigure}

end{document}






macros table-of-contents errors hyperref urls






share|improve this question









New contributor




Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









David Carlisle

482k4011151853




482k4011151853






New contributor




Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









Terrenay

62




62




New contributor




Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Terrenay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    caption[ {lof[(Accessed on 02.01.2019)] {Basic neural network with three layers} {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ] {Basic neural network with three layers} -- you must enclose the lot[...]{}{} command with a {} pair, since it has an optional argument and occurs in the optional argument of caption
    – Christian Hupfer
    2 hours ago








  • 1




    You might want to have a look at the xparse package, which makes it considerably easier to define commands with multiple optonal arguments.
    – GuM
    2 hours ago






  • 1




    @Terrenay: Then add the complete code, not just fragments only
    – Christian Hupfer
    2 hours ago






  • 1




    As you are new, I extended your fragment with the missing definitions and replacing with generally available images, however it does not produce the error that you are asking about. Please edit the example so that it is an example of the error.
    – David Carlisle
    2 hours ago






  • 1




    also you should delete your .aux and .lof files which may be corrupted by previous errors.
    – David Carlisle
    2 hours ago
















  • 1




    caption[ {lof[(Accessed on 02.01.2019)] {Basic neural network with three layers} {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ] {Basic neural network with three layers} -- you must enclose the lot[...]{}{} command with a {} pair, since it has an optional argument and occurs in the optional argument of caption
    – Christian Hupfer
    2 hours ago








  • 1




    You might want to have a look at the xparse package, which makes it considerably easier to define commands with multiple optonal arguments.
    – GuM
    2 hours ago






  • 1




    @Terrenay: Then add the complete code, not just fragments only
    – Christian Hupfer
    2 hours ago






  • 1




    As you are new, I extended your fragment with the missing definitions and replacing with generally available images, however it does not produce the error that you are asking about. Please edit the example so that it is an example of the error.
    – David Carlisle
    2 hours ago






  • 1




    also you should delete your .aux and .lof files which may be corrupted by previous errors.
    – David Carlisle
    2 hours ago










1




1




caption[ {lof[(Accessed on 02.01.2019)] {Basic neural network with three layers} {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ] {Basic neural network with three layers} -- you must enclose the lot[...]{}{} command with a {} pair, since it has an optional argument and occurs in the optional argument of caption
– Christian Hupfer
2 hours ago






caption[ {lof[(Accessed on 02.01.2019)] {Basic neural network with three layers} {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}} ] {Basic neural network with three layers} -- you must enclose the lot[...]{}{} command with a {} pair, since it has an optional argument and occurs in the optional argument of caption
– Christian Hupfer
2 hours ago






1




1




You might want to have a look at the xparse package, which makes it considerably easier to define commands with multiple optonal arguments.
– GuM
2 hours ago




You might want to have a look at the xparse package, which makes it considerably easier to define commands with multiple optonal arguments.
– GuM
2 hours ago




1




1




@Terrenay: Then add the complete code, not just fragments only
– Christian Hupfer
2 hours ago




@Terrenay: Then add the complete code, not just fragments only
– Christian Hupfer
2 hours ago




1




1




As you are new, I extended your fragment with the missing definitions and replacing with generally available images, however it does not produce the error that you are asking about. Please edit the example so that it is an example of the error.
– David Carlisle
2 hours ago




As you are new, I extended your fragment with the missing definitions and replacing with generally available images, however it does not produce the error that you are asking about. Please edit the example so that it is an example of the error.
– David Carlisle
2 hours ago




1




1




also you should delete your .aux and .lof files which may be corrupted by previous errors.
– David Carlisle
2 hours ago






also you should delete your .aux and .lof files which may be corrupted by previous errors.
– David Carlisle
2 hours ago












1 Answer
1






active

oldest

votes


















1














I get no error, but your input is very awkward and error prone.



I suggest to define a new xcaption command, so as to minimize the burden.



documentclass{article}
usepackage{xparse}
usepackage{amsmath}
usepackage{wrapfig}
usepackage{graphicx}
usepackage{hyperref}

usepackage{kantlipsum}

NewDocumentCommand{xcaption}{O{#2}mmo}{%
caption[lof{#1}{#3IfValueT{#4}{ #4}}]{#2}%
}
NewDocumentCommand{lof}{mm}{%
{boldmathtextbf{#1}}newline
{scriptsize #2}%
}

begin{document}

listoffigures

begin{wrapfigure}{r}{0.25textwidth}
centering
includegraphics[width=0.25textwidth]{example-image}
xcaption
{Basic neural network with three layers}
{url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
[(Accessed on 02.01.2019)]
label{fig:nn}
end{wrapfigure}

kant[1]

begin{wrapfigure}{h}{0.5textwidth}
centering
includegraphics[width=0.5textwidth]{example-image}
xcaption
[Short caption with $sigma(x)$]
{$sigma (x)$, the sigmoid function}
{Created by the author}
label{fig:sigmoid}
end{wrapfigure}

kant[1]

end{document}


The syntax is



xcaption
[<optional caption for the lof>]
{<main caption>}
{<attribution>}
[<optional info>]


I added an example of the optional caption, also showing how to get bold math without explicitly adding boldsymbol.



The lof command is only auxiliary and it shouldn't be really used in the document.



enter image description here






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
    });


    }
    });






    Terrenay is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468333%2ferror-argument-of-newcommand-has-an-extra%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









    1














    I get no error, but your input is very awkward and error prone.



    I suggest to define a new xcaption command, so as to minimize the burden.



    documentclass{article}
    usepackage{xparse}
    usepackage{amsmath}
    usepackage{wrapfig}
    usepackage{graphicx}
    usepackage{hyperref}

    usepackage{kantlipsum}

    NewDocumentCommand{xcaption}{O{#2}mmo}{%
    caption[lof{#1}{#3IfValueT{#4}{ #4}}]{#2}%
    }
    NewDocumentCommand{lof}{mm}{%
    {boldmathtextbf{#1}}newline
    {scriptsize #2}%
    }

    begin{document}

    listoffigures

    begin{wrapfigure}{r}{0.25textwidth}
    centering
    includegraphics[width=0.25textwidth]{example-image}
    xcaption
    {Basic neural network with three layers}
    {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
    [(Accessed on 02.01.2019)]
    label{fig:nn}
    end{wrapfigure}

    kant[1]

    begin{wrapfigure}{h}{0.5textwidth}
    centering
    includegraphics[width=0.5textwidth]{example-image}
    xcaption
    [Short caption with $sigma(x)$]
    {$sigma (x)$, the sigmoid function}
    {Created by the author}
    label{fig:sigmoid}
    end{wrapfigure}

    kant[1]

    end{document}


    The syntax is



    xcaption
    [<optional caption for the lof>]
    {<main caption>}
    {<attribution>}
    [<optional info>]


    I added an example of the optional caption, also showing how to get bold math without explicitly adding boldsymbol.



    The lof command is only auxiliary and it shouldn't be really used in the document.



    enter image description here






    share|improve this answer


























      1














      I get no error, but your input is very awkward and error prone.



      I suggest to define a new xcaption command, so as to minimize the burden.



      documentclass{article}
      usepackage{xparse}
      usepackage{amsmath}
      usepackage{wrapfig}
      usepackage{graphicx}
      usepackage{hyperref}

      usepackage{kantlipsum}

      NewDocumentCommand{xcaption}{O{#2}mmo}{%
      caption[lof{#1}{#3IfValueT{#4}{ #4}}]{#2}%
      }
      NewDocumentCommand{lof}{mm}{%
      {boldmathtextbf{#1}}newline
      {scriptsize #2}%
      }

      begin{document}

      listoffigures

      begin{wrapfigure}{r}{0.25textwidth}
      centering
      includegraphics[width=0.25textwidth]{example-image}
      xcaption
      {Basic neural network with three layers}
      {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
      [(Accessed on 02.01.2019)]
      label{fig:nn}
      end{wrapfigure}

      kant[1]

      begin{wrapfigure}{h}{0.5textwidth}
      centering
      includegraphics[width=0.5textwidth]{example-image}
      xcaption
      [Short caption with $sigma(x)$]
      {$sigma (x)$, the sigmoid function}
      {Created by the author}
      label{fig:sigmoid}
      end{wrapfigure}

      kant[1]

      end{document}


      The syntax is



      xcaption
      [<optional caption for the lof>]
      {<main caption>}
      {<attribution>}
      [<optional info>]


      I added an example of the optional caption, also showing how to get bold math without explicitly adding boldsymbol.



      The lof command is only auxiliary and it shouldn't be really used in the document.



      enter image description here






      share|improve this answer
























        1












        1








        1






        I get no error, but your input is very awkward and error prone.



        I suggest to define a new xcaption command, so as to minimize the burden.



        documentclass{article}
        usepackage{xparse}
        usepackage{amsmath}
        usepackage{wrapfig}
        usepackage{graphicx}
        usepackage{hyperref}

        usepackage{kantlipsum}

        NewDocumentCommand{xcaption}{O{#2}mmo}{%
        caption[lof{#1}{#3IfValueT{#4}{ #4}}]{#2}%
        }
        NewDocumentCommand{lof}{mm}{%
        {boldmathtextbf{#1}}newline
        {scriptsize #2}%
        }

        begin{document}

        listoffigures

        begin{wrapfigure}{r}{0.25textwidth}
        centering
        includegraphics[width=0.25textwidth]{example-image}
        xcaption
        {Basic neural network with three layers}
        {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
        [(Accessed on 02.01.2019)]
        label{fig:nn}
        end{wrapfigure}

        kant[1]

        begin{wrapfigure}{h}{0.5textwidth}
        centering
        includegraphics[width=0.5textwidth]{example-image}
        xcaption
        [Short caption with $sigma(x)$]
        {$sigma (x)$, the sigmoid function}
        {Created by the author}
        label{fig:sigmoid}
        end{wrapfigure}

        kant[1]

        end{document}


        The syntax is



        xcaption
        [<optional caption for the lof>]
        {<main caption>}
        {<attribution>}
        [<optional info>]


        I added an example of the optional caption, also showing how to get bold math without explicitly adding boldsymbol.



        The lof command is only auxiliary and it shouldn't be really used in the document.



        enter image description here






        share|improve this answer












        I get no error, but your input is very awkward and error prone.



        I suggest to define a new xcaption command, so as to minimize the burden.



        documentclass{article}
        usepackage{xparse}
        usepackage{amsmath}
        usepackage{wrapfig}
        usepackage{graphicx}
        usepackage{hyperref}

        usepackage{kantlipsum}

        NewDocumentCommand{xcaption}{O{#2}mmo}{%
        caption[lof{#1}{#3IfValueT{#4}{ #4}}]{#2}%
        }
        NewDocumentCommand{lof}{mm}{%
        {boldmathtextbf{#1}}newline
        {scriptsize #2}%
        }

        begin{document}

        listoffigures

        begin{wrapfigure}{r}{0.25textwidth}
        centering
        includegraphics[width=0.25textwidth]{example-image}
        xcaption
        {Basic neural network with three layers}
        {url{https://commons.wikimedia.org/wiki/File:Artificial_neural_network.svg}}
        [(Accessed on 02.01.2019)]
        label{fig:nn}
        end{wrapfigure}

        kant[1]

        begin{wrapfigure}{h}{0.5textwidth}
        centering
        includegraphics[width=0.5textwidth]{example-image}
        xcaption
        [Short caption with $sigma(x)$]
        {$sigma (x)$, the sigmoid function}
        {Created by the author}
        label{fig:sigmoid}
        end{wrapfigure}

        kant[1]

        end{document}


        The syntax is



        xcaption
        [<optional caption for the lof>]
        {<main caption>}
        {<attribution>}
        [<optional info>]


        I added an example of the optional caption, also showing how to get bold math without explicitly adding boldsymbol.



        The lof command is only auxiliary and it shouldn't be really used in the document.



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 hours ago









        egreg

        709k8618833167




        709k8618833167






















            Terrenay is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Terrenay is a new contributor. Be nice, and check out our Code of Conduct.













            Terrenay is a new contributor. Be nice, and check out our Code of Conduct.












            Terrenay is a new contributor. Be nice, and check out our Code of Conduct.
















            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f468333%2ferror-argument-of-newcommand-has-an-extra%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

            Lallio

            Futebolista

            Jornalista