htlatex: img with alt tag and custom class The Next CEO of Stack OverflowWhen generating html, how do you specify image size?tex4ht: customize includegraphics conversion to HTMLWhen generating html, how do you specify image size?htlatex with article vs memoirhtlatex/tex4ht with ScriptEnv and HTML entitieshtlatex and subfiguresPDF image files and `htlatex`: ProblemCorrect encoding for `<` in `alt` attributes in htlatexHow to get htlatex to use a custom filename for per section html files?Wrong tag ordering in mathml produced using htlatexproblem with htlatex and tex4ht.envUse tabu with htlatex

How do I reset passwords on multiple websites easily?

Why didn't Khan get resurrected in the Genesis Explosion?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Written every which way

Which tube will fit a -(700 x 25c) wheel?

Make solar eclipses exceedingly rare, but still have new moons

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

What was the first Unix version to run on a microcomputer?

Can you replace a racial trait cantrip when leveling up?

Elegant way to replace substring in a regex with optional groups in Python?

What flight has the highest ratio of time difference to flight time?

Is "for causing autism in X" grammatical?

How do I avoid eval and parse?

To not tell, not take, and not want

Is 'diverse range' a pleonastic phrase?

What can we do to stop prior company from asking us questions?

If a black hole is created from light, can this black hole then move at speed of light?

How do scammers retract money, while you can’t?

How do I transpose the 1st and -1th levels of an arbitrarily nested array?

Bold, vivid family

Why do remote companies require working in the US?

What happens if you roll doubles 3 times then land on "Go to jail?"

How do I make a variable always equal to the result of some calculations?

Novel about a guy who is possessed by the divine essence and the world ends?



htlatex: img with alt tag and custom class



The Next CEO of Stack OverflowWhen generating html, how do you specify image size?tex4ht: customize includegraphics conversion to HTMLWhen generating html, how do you specify image size?htlatex with article vs memoirhtlatex/tex4ht with ScriptEnv and HTML entitieshtlatex and subfiguresPDF image files and `htlatex`: ProblemCorrect encoding for `<` in `alt` attributes in htlatexHow to get htlatex to use a custom filename for per section html files?Wrong tag ordering in mathml produced using htlatexproblem with htlatex and tex4ht.envUse tabu with htlatex










2















This question is something of a follow-up to tex4ht: customize includegraphics conversion to HTML and also to When generating html, how do you specify image size?



background



In my .tex file I specify images to be included as follows:



includegraphics[alt=alt tags, information]example-image-a


and have theimg element wrapped in its own container:



<div class="figure"><!--l. 7-->
<p class="noindent"></p>
<div class="my-box"><img src="mwe0x.png" alt="PIC" class=
"my-class" /></div>
<!--l. 8-->
<p class="indent"></p>
</div>


I use the following cmh.cfg:



Preamblehtml5
makeatletter
define@keyGinalt
ConfigureGraphicsAltmy alt text
Configuregraphics
HCode<div class="my-box">%
Picture+[PIC] class="my-class"
EndPicture HCode</div>
begindocument
EndPreamble


and produce the html output above using the call:



make4ht -u -f html5 -c cmh.cfg mwe.tex


goal



I'd like to have the ALT tag updated from the includegraphics call.



I've tried the following modification to cmh.cfg



Picture+[a:GraphicsAlt] class="my-class"}


but this results in




Missing $ inserted




the question



How can I change my cmh.cfg file so that the img element receives custom alt tags and my custom class?



mwe.tex



documentclassarticle
usepackagegraphicx
begindocument

here is some text
beginfigure
includegraphics[alt=descriptions,info]example-image-a
endfigure
enddocument


cmh.cfg



Preamblehtml5
makeatletter
define@keyGinalt
ConfigureGraphicsAltmy alt text
Configuregraphics
HCode<div class="my-box">%
Picture+[PIC] class="my-class"
EndPicture HCode</div>
begindocument
EndPreamble


call



make4ht -u -f html5 -c cmh.cfg mwe.tex









share|improve this question


























    2















    This question is something of a follow-up to tex4ht: customize includegraphics conversion to HTML and also to When generating html, how do you specify image size?



    background



    In my .tex file I specify images to be included as follows:



    includegraphics[alt=alt tags, information]example-image-a


    and have theimg element wrapped in its own container:



    <div class="figure"><!--l. 7-->
    <p class="noindent"></p>
    <div class="my-box"><img src="mwe0x.png" alt="PIC" class=
    "my-class" /></div>
    <!--l. 8-->
    <p class="indent"></p>
    </div>


    I use the following cmh.cfg:



    Preamblehtml5
    makeatletter
    define@keyGinalt
    ConfigureGraphicsAltmy alt text
    Configuregraphics
    HCode<div class="my-box">%
    Picture+[PIC] class="my-class"
    EndPicture HCode</div>
    begindocument
    EndPreamble


    and produce the html output above using the call:



    make4ht -u -f html5 -c cmh.cfg mwe.tex


    goal



    I'd like to have the ALT tag updated from the includegraphics call.



    I've tried the following modification to cmh.cfg



    Picture+[a:GraphicsAlt] class="my-class"}


    but this results in




    Missing $ inserted




    the question



    How can I change my cmh.cfg file so that the img element receives custom alt tags and my custom class?



    mwe.tex



    documentclassarticle
    usepackagegraphicx
    begindocument

    here is some text
    beginfigure
    includegraphics[alt=descriptions,info]example-image-a
    endfigure
    enddocument


    cmh.cfg



    Preamblehtml5
    makeatletter
    define@keyGinalt
    ConfigureGraphicsAltmy alt text
    Configuregraphics
    HCode<div class="my-box">%
    Picture+[PIC] class="my-class"
    EndPicture HCode</div>
    begindocument
    EndPreamble


    call



    make4ht -u -f html5 -c cmh.cfg mwe.tex









    share|improve this question
























      2












      2








      2








      This question is something of a follow-up to tex4ht: customize includegraphics conversion to HTML and also to When generating html, how do you specify image size?



      background



      In my .tex file I specify images to be included as follows:



      includegraphics[alt=alt tags, information]example-image-a


      and have theimg element wrapped in its own container:



      <div class="figure"><!--l. 7-->
      <p class="noindent"></p>
      <div class="my-box"><img src="mwe0x.png" alt="PIC" class=
      "my-class" /></div>
      <!--l. 8-->
      <p class="indent"></p>
      </div>


      I use the following cmh.cfg:



      Preamblehtml5
      makeatletter
      define@keyGinalt
      ConfigureGraphicsAltmy alt text
      Configuregraphics
      HCode<div class="my-box">%
      Picture+[PIC] class="my-class"
      EndPicture HCode</div>
      begindocument
      EndPreamble


      and produce the html output above using the call:



      make4ht -u -f html5 -c cmh.cfg mwe.tex


      goal



      I'd like to have the ALT tag updated from the includegraphics call.



      I've tried the following modification to cmh.cfg



      Picture+[a:GraphicsAlt] class="my-class"}


      but this results in




      Missing $ inserted




      the question



      How can I change my cmh.cfg file so that the img element receives custom alt tags and my custom class?



      mwe.tex



      documentclassarticle
      usepackagegraphicx
      begindocument

      here is some text
      beginfigure
      includegraphics[alt=descriptions,info]example-image-a
      endfigure
      enddocument


      cmh.cfg



      Preamblehtml5
      makeatletter
      define@keyGinalt
      ConfigureGraphicsAltmy alt text
      Configuregraphics
      HCode<div class="my-box">%
      Picture+[PIC] class="my-class"
      EndPicture HCode</div>
      begindocument
      EndPreamble


      call



      make4ht -u -f html5 -c cmh.cfg mwe.tex









      share|improve this question














      This question is something of a follow-up to tex4ht: customize includegraphics conversion to HTML and also to When generating html, how do you specify image size?



      background



      In my .tex file I specify images to be included as follows:



      includegraphics[alt=alt tags, information]example-image-a


      and have theimg element wrapped in its own container:



      <div class="figure"><!--l. 7-->
      <p class="noindent"></p>
      <div class="my-box"><img src="mwe0x.png" alt="PIC" class=
      "my-class" /></div>
      <!--l. 8-->
      <p class="indent"></p>
      </div>


      I use the following cmh.cfg:



      Preamblehtml5
      makeatletter
      define@keyGinalt
      ConfigureGraphicsAltmy alt text
      Configuregraphics
      HCode<div class="my-box">%
      Picture+[PIC] class="my-class"
      EndPicture HCode</div>
      begindocument
      EndPreamble


      and produce the html output above using the call:



      make4ht -u -f html5 -c cmh.cfg mwe.tex


      goal



      I'd like to have the ALT tag updated from the includegraphics call.



      I've tried the following modification to cmh.cfg



      Picture+[a:GraphicsAlt] class="my-class"}


      but this results in




      Missing $ inserted




      the question



      How can I change my cmh.cfg file so that the img element receives custom alt tags and my custom class?



      mwe.tex



      documentclassarticle
      usepackagegraphicx
      begindocument

      here is some text
      beginfigure
      includegraphics[alt=descriptions,info]example-image-a
      endfigure
      enddocument


      cmh.cfg



      Preamblehtml5
      makeatletter
      define@keyGinalt
      ConfigureGraphicsAltmy alt text
      Configuregraphics
      HCode<div class="my-box">%
      Picture+[PIC] class="my-class"
      EndPicture HCode</div>
      begindocument
      EndPreamble


      call



      make4ht -u -f html5 -c cmh.cfg mwe.tex






      tex4ht htlatex accessibility






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 13 hours ago









      cmhughescmhughes

      79.6k17201300




      79.6k17201300




















          1 Answer
          1






          active

          oldest

          votes


















          2














          I would use a following configuration file:



          Preamblexhtml
          makeatletter
          DeclareGraphicsExtensions.png,.jpg,.svg
          define@keyGinaltConfigureGraphicsAlt#1
          defmygraphicsConfigureNeedsFile: Gin@baseGin@extNeeds%
          ifvmodeIgnoreParfiEndPHCode<div class="my-box">Picture[csname a:GraphicsAltendcsname]Gin@baseGin@ext csname a:Gin-dimendcsname class="my-class"
          HCode</div>ShowPar
          Configuregraphics*
          png
          mygraphics
          Configuregraphics*
          jpg
          mygraphics
          Configuregraphics*
          jpeg
          mygraphics
          Configuregraphics*
          svg
          mygraphics

          begindocument

          EndPreamble


          The DeclareGraphicsExtension is used to declare graphics filetypes supported in HTML. The mygraphics macro contains common code inserted for graphics, especially dimensions, alt and class. It is then used in configurations for supported graphics types, so we can save some repetition. The alt text is declared by define@keyGinaltConfigureGraphicsAlt#1.



          You also need to copy the example-image-a.png file to the current directory and save its dimensions using ebb -x example-image-a.png command.



          The result:



          <!--l. 8--><p class="noindent" >here is some text </p><figure class="figure"> 



          <!--l. 10--><p class="noindent" ></p><div class="my-box"><img
          src="example-image-a.png" alt="descriptions,info"
          width="401" height="301" class="my-class" /></div>

          </figure>





          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%2f482146%2fhtlatex-img-with-alt-tag-and-custom-class%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









            2














            I would use a following configuration file:



            Preamblexhtml
            makeatletter
            DeclareGraphicsExtensions.png,.jpg,.svg
            define@keyGinaltConfigureGraphicsAlt#1
            defmygraphicsConfigureNeedsFile: Gin@baseGin@extNeeds%
            ifvmodeIgnoreParfiEndPHCode<div class="my-box">Picture[csname a:GraphicsAltendcsname]Gin@baseGin@ext csname a:Gin-dimendcsname class="my-class"
            HCode</div>ShowPar
            Configuregraphics*
            png
            mygraphics
            Configuregraphics*
            jpg
            mygraphics
            Configuregraphics*
            jpeg
            mygraphics
            Configuregraphics*
            svg
            mygraphics

            begindocument

            EndPreamble


            The DeclareGraphicsExtension is used to declare graphics filetypes supported in HTML. The mygraphics macro contains common code inserted for graphics, especially dimensions, alt and class. It is then used in configurations for supported graphics types, so we can save some repetition. The alt text is declared by define@keyGinaltConfigureGraphicsAlt#1.



            You also need to copy the example-image-a.png file to the current directory and save its dimensions using ebb -x example-image-a.png command.



            The result:



            <!--l. 8--><p class="noindent" >here is some text </p><figure class="figure"> 



            <!--l. 10--><p class="noindent" ></p><div class="my-box"><img
            src="example-image-a.png" alt="descriptions,info"
            width="401" height="301" class="my-class" /></div>

            </figure>





            share|improve this answer



























              2














              I would use a following configuration file:



              Preamblexhtml
              makeatletter
              DeclareGraphicsExtensions.png,.jpg,.svg
              define@keyGinaltConfigureGraphicsAlt#1
              defmygraphicsConfigureNeedsFile: Gin@baseGin@extNeeds%
              ifvmodeIgnoreParfiEndPHCode<div class="my-box">Picture[csname a:GraphicsAltendcsname]Gin@baseGin@ext csname a:Gin-dimendcsname class="my-class"
              HCode</div>ShowPar
              Configuregraphics*
              png
              mygraphics
              Configuregraphics*
              jpg
              mygraphics
              Configuregraphics*
              jpeg
              mygraphics
              Configuregraphics*
              svg
              mygraphics

              begindocument

              EndPreamble


              The DeclareGraphicsExtension is used to declare graphics filetypes supported in HTML. The mygraphics macro contains common code inserted for graphics, especially dimensions, alt and class. It is then used in configurations for supported graphics types, so we can save some repetition. The alt text is declared by define@keyGinaltConfigureGraphicsAlt#1.



              You also need to copy the example-image-a.png file to the current directory and save its dimensions using ebb -x example-image-a.png command.



              The result:



              <!--l. 8--><p class="noindent" >here is some text </p><figure class="figure"> 



              <!--l. 10--><p class="noindent" ></p><div class="my-box"><img
              src="example-image-a.png" alt="descriptions,info"
              width="401" height="301" class="my-class" /></div>

              </figure>





              share|improve this answer

























                2












                2








                2







                I would use a following configuration file:



                Preamblexhtml
                makeatletter
                DeclareGraphicsExtensions.png,.jpg,.svg
                define@keyGinaltConfigureGraphicsAlt#1
                defmygraphicsConfigureNeedsFile: Gin@baseGin@extNeeds%
                ifvmodeIgnoreParfiEndPHCode<div class="my-box">Picture[csname a:GraphicsAltendcsname]Gin@baseGin@ext csname a:Gin-dimendcsname class="my-class"
                HCode</div>ShowPar
                Configuregraphics*
                png
                mygraphics
                Configuregraphics*
                jpg
                mygraphics
                Configuregraphics*
                jpeg
                mygraphics
                Configuregraphics*
                svg
                mygraphics

                begindocument

                EndPreamble


                The DeclareGraphicsExtension is used to declare graphics filetypes supported in HTML. The mygraphics macro contains common code inserted for graphics, especially dimensions, alt and class. It is then used in configurations for supported graphics types, so we can save some repetition. The alt text is declared by define@keyGinaltConfigureGraphicsAlt#1.



                You also need to copy the example-image-a.png file to the current directory and save its dimensions using ebb -x example-image-a.png command.



                The result:



                <!--l. 8--><p class="noindent" >here is some text </p><figure class="figure"> 



                <!--l. 10--><p class="noindent" ></p><div class="my-box"><img
                src="example-image-a.png" alt="descriptions,info"
                width="401" height="301" class="my-class" /></div>

                </figure>





                share|improve this answer













                I would use a following configuration file:



                Preamblexhtml
                makeatletter
                DeclareGraphicsExtensions.png,.jpg,.svg
                define@keyGinaltConfigureGraphicsAlt#1
                defmygraphicsConfigureNeedsFile: Gin@baseGin@extNeeds%
                ifvmodeIgnoreParfiEndPHCode<div class="my-box">Picture[csname a:GraphicsAltendcsname]Gin@baseGin@ext csname a:Gin-dimendcsname class="my-class"
                HCode</div>ShowPar
                Configuregraphics*
                png
                mygraphics
                Configuregraphics*
                jpg
                mygraphics
                Configuregraphics*
                jpeg
                mygraphics
                Configuregraphics*
                svg
                mygraphics

                begindocument

                EndPreamble


                The DeclareGraphicsExtension is used to declare graphics filetypes supported in HTML. The mygraphics macro contains common code inserted for graphics, especially dimensions, alt and class. It is then used in configurations for supported graphics types, so we can save some repetition. The alt text is declared by define@keyGinaltConfigureGraphicsAlt#1.



                You also need to copy the example-image-a.png file to the current directory and save its dimensions using ebb -x example-image-a.png command.



                The result:



                <!--l. 8--><p class="noindent" >here is some text </p><figure class="figure"> 



                <!--l. 10--><p class="noindent" ></p><div class="my-box"><img
                src="example-image-a.png" alt="descriptions,info"
                width="401" height="301" class="my-class" /></div>

                </figure>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 8 hours ago









                michal.h21michal.h21

                31.8k447105




                31.8k447105



























                    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%2f482146%2fhtlatex-img-with-alt-tag-and-custom-class%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

                    Wikipedia:Contact us Navigation menu Navigation menuLeave a Reply Cancel reply Post navigationRecent PostsRecent CommentsArchivesCategoriesMeta

                    Farafra Inhaltsverzeichnis Geschichte | Badr-Museum Farafra | Nationalpark Weiße Wüste (as-Sahra al-baida) | Literatur | Weblinks | Navigationsmenü27° 3′ N, 27° 58′ OCommons: Farafra

                    Tórshavn Kliima | Partnerstääden | Luke uk diar | Nawigatsjuun62° 1′ N, 6° 46′ W62° 1′ 0″ N, 6° 46′ 0″ WWMOTórshavn