How to add a continuous line at the end of every caption?












2















I am new to lyx. I would like to know what should i write in the LaTeX preamble of the document to add a continuous line at the end of each caption and another line to separate the foot from the text (Just like the line that appears to separate the header from the body text when you use fancy option in page style).










share|improve this question





























    2















    I am new to lyx. I would like to know what should i write in the LaTeX preamble of the document to add a continuous line at the end of each caption and another line to separate the foot from the text (Just like the line that appears to separate the header from the body text when you use fancy option in page style).










    share|improve this question



























      2












      2








      2








      I am new to lyx. I would like to know what should i write in the LaTeX preamble of the document to add a continuous line at the end of each caption and another line to separate the foot from the text (Just like the line that appears to separate the header from the body text when you use fancy option in page style).










      share|improve this question
















      I am new to lyx. I would like to know what should i write in the LaTeX preamble of the document to add a continuous line at the end of each caption and another line to separate the foot from the text (Just like the line that appears to separate the header from the body text when you use fancy option in page style).







      header-footer captions lyx rules






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 3 at 1:47









      Werner

      443k689791676




      443k689791676










      asked Feb 3 at 1:24









      MartínMartín

      111




      111






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Welcome to TeX.SE! This answer is based on this answer, and both are using the caption package.



          documentclass{article}
          usepackage{graphicx}
          usepackage{caption}

          DeclareCaptionTextFormat{myformat}{#1hrulefill}
          captionsetup[figure]{textformat=myformat}



          begin{document}
          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a caption.}
          label{fig:test}
          end{figure}


          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a very long caption. Normally one should try to avoid long
          captions but this here is to illustrate that it works also if the text runs
          over several lines.}
          label{fig:testlong}
          end{figure}

          end{document}


          enter image description here






          share|improve this answer
























          • Your code worked well, just like you showed in your images. How ever the best coding for my question is the one you cited in your answer: usepackage{caption} DeclareCaptionFormat{myformat}{#1#2#3hrulefill} captionsetup[figure]{format=myformat}

            – Martín
            Feb 3 at 13:43













          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%2f473120%2fhow-to-add-a-continuous-line-at-the-end-of-every-caption%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














          Welcome to TeX.SE! This answer is based on this answer, and both are using the caption package.



          documentclass{article}
          usepackage{graphicx}
          usepackage{caption}

          DeclareCaptionTextFormat{myformat}{#1hrulefill}
          captionsetup[figure]{textformat=myformat}



          begin{document}
          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a caption.}
          label{fig:test}
          end{figure}


          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a very long caption. Normally one should try to avoid long
          captions but this here is to illustrate that it works also if the text runs
          over several lines.}
          label{fig:testlong}
          end{figure}

          end{document}


          enter image description here






          share|improve this answer
























          • Your code worked well, just like you showed in your images. How ever the best coding for my question is the one you cited in your answer: usepackage{caption} DeclareCaptionFormat{myformat}{#1#2#3hrulefill} captionsetup[figure]{format=myformat}

            – Martín
            Feb 3 at 13:43


















          2














          Welcome to TeX.SE! This answer is based on this answer, and both are using the caption package.



          documentclass{article}
          usepackage{graphicx}
          usepackage{caption}

          DeclareCaptionTextFormat{myformat}{#1hrulefill}
          captionsetup[figure]{textformat=myformat}



          begin{document}
          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a caption.}
          label{fig:test}
          end{figure}


          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a very long caption. Normally one should try to avoid long
          captions but this here is to illustrate that it works also if the text runs
          over several lines.}
          label{fig:testlong}
          end{figure}

          end{document}


          enter image description here






          share|improve this answer
























          • Your code worked well, just like you showed in your images. How ever the best coding for my question is the one you cited in your answer: usepackage{caption} DeclareCaptionFormat{myformat}{#1#2#3hrulefill} captionsetup[figure]{format=myformat}

            – Martín
            Feb 3 at 13:43
















          2












          2








          2







          Welcome to TeX.SE! This answer is based on this answer, and both are using the caption package.



          documentclass{article}
          usepackage{graphicx}
          usepackage{caption}

          DeclareCaptionTextFormat{myformat}{#1hrulefill}
          captionsetup[figure]{textformat=myformat}



          begin{document}
          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a caption.}
          label{fig:test}
          end{figure}


          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a very long caption. Normally one should try to avoid long
          captions but this here is to illustrate that it works also if the text runs
          over several lines.}
          label{fig:testlong}
          end{figure}

          end{document}


          enter image description here






          share|improve this answer













          Welcome to TeX.SE! This answer is based on this answer, and both are using the caption package.



          documentclass{article}
          usepackage{graphicx}
          usepackage{caption}

          DeclareCaptionTextFormat{myformat}{#1hrulefill}
          captionsetup[figure]{textformat=myformat}



          begin{document}
          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a caption.}
          label{fig:test}
          end{figure}


          begin{figure}[tb]
          centering
          includegraphics[width=textwidth]{example-image-duck}
          caption{I'm a very long caption. Normally one should try to avoid long
          captions but this here is to illustrate that it works also if the text runs
          over several lines.}
          label{fig:testlong}
          end{figure}

          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 3 at 2:32









          marmotmarmot

          98.9k4113219




          98.9k4113219













          • Your code worked well, just like you showed in your images. How ever the best coding for my question is the one you cited in your answer: usepackage{caption} DeclareCaptionFormat{myformat}{#1#2#3hrulefill} captionsetup[figure]{format=myformat}

            – Martín
            Feb 3 at 13:43





















          • Your code worked well, just like you showed in your images. How ever the best coding for my question is the one you cited in your answer: usepackage{caption} DeclareCaptionFormat{myformat}{#1#2#3hrulefill} captionsetup[figure]{format=myformat}

            – Martín
            Feb 3 at 13:43



















          Your code worked well, just like you showed in your images. How ever the best coding for my question is the one you cited in your answer: usepackage{caption} DeclareCaptionFormat{myformat}{#1#2#3hrulefill} captionsetup[figure]{format=myformat}

          – Martín
          Feb 3 at 13:43







          Your code worked well, just like you showed in your images. How ever the best coding for my question is the one you cited in your answer: usepackage{caption} DeclareCaptionFormat{myformat}{#1#2#3hrulefill} captionsetup[figure]{format=myformat}

          – Martín
          Feb 3 at 13:43




















          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%2f473120%2fhow-to-add-a-continuous-line-at-the-end-of-every-caption%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

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?