Fixing the length of underline text












1















I was looking for an example here about setting the lengh of the command underline.
I'm trying to produce a text on top of a line with 10cm fixed length, with text of variable size. In addition the text should be left aligned (not centered as the examples founded here produce)
Here's a minimal example. Thank you.



documentclass[a4paper,brazil, 12pt]{report}
usepackage{amsmath,amsfonts,amscd,bezier}
usepackage{amssymb}
usepackage{babel}
usepackage[latin1]{inputenc}
usepackage[shortlabels]{enumitem}
usepackage{multicol}
usepackage{tasks}
usepackage{tikz, tkz-euclide}

%%https://tex.stackexchange.com/questions/334787/constant-length-of-underline

usepackage{eqparbox, ulem}
newcommandulmakebox[2][ULB]{eqsetminwidth{#1}{10cm}underline{eqmakebox[#1]{#2}}}

newcommand{wideunderline}[2][2em]{%
underline{makebox[ifdimwidth>#1widthelse#1fi]{#2}}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


begin{document}

begin{minipage}{5cm}
noindent (line 1) $mathbf{u+w=v+w},$

noindent (line 2) $mathbf{u+w=v+w},$

noindent (line 3) $mathbf{u+w=v+w},$

noindent (line 4) $mathbf{u+w=v+w},$

noindent (line 5) $mathbf{u+w=v+w},$

noindent (line 6) $mathbf{u+w=v+w},$
end{minipage}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%hspace*{4.4cm}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{minipage}{10cm}

underline{text here (in front of line 1) hspace{4cm}}

underline{more text here (in front of line 2) hspace{3cm}}

noindent ulmakebox{noindent(in front of line 3)}

wideunderline[10cm]{noindent text here (in front of line 4)}

begin{tikzpicture} %without text line in front of line 5
draw (0,0) to (10,0);
end{tikzpicture}

begin{tikzpicture} %without text line in front of line 6
draw (0,0) to (10,0);
end{tikzpicture}
end{minipage}

end{document}









share|improve this question























  • In the linked question there is a comment about left alignment (tex.stackexchange.com/questions/334787/…), maybe that can help you?

    – Marijn
    5 hours ago
















1















I was looking for an example here about setting the lengh of the command underline.
I'm trying to produce a text on top of a line with 10cm fixed length, with text of variable size. In addition the text should be left aligned (not centered as the examples founded here produce)
Here's a minimal example. Thank you.



documentclass[a4paper,brazil, 12pt]{report}
usepackage{amsmath,amsfonts,amscd,bezier}
usepackage{amssymb}
usepackage{babel}
usepackage[latin1]{inputenc}
usepackage[shortlabels]{enumitem}
usepackage{multicol}
usepackage{tasks}
usepackage{tikz, tkz-euclide}

%%https://tex.stackexchange.com/questions/334787/constant-length-of-underline

usepackage{eqparbox, ulem}
newcommandulmakebox[2][ULB]{eqsetminwidth{#1}{10cm}underline{eqmakebox[#1]{#2}}}

newcommand{wideunderline}[2][2em]{%
underline{makebox[ifdimwidth>#1widthelse#1fi]{#2}}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


begin{document}

begin{minipage}{5cm}
noindent (line 1) $mathbf{u+w=v+w},$

noindent (line 2) $mathbf{u+w=v+w},$

noindent (line 3) $mathbf{u+w=v+w},$

noindent (line 4) $mathbf{u+w=v+w},$

noindent (line 5) $mathbf{u+w=v+w},$

noindent (line 6) $mathbf{u+w=v+w},$
end{minipage}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%hspace*{4.4cm}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{minipage}{10cm}

underline{text here (in front of line 1) hspace{4cm}}

underline{more text here (in front of line 2) hspace{3cm}}

noindent ulmakebox{noindent(in front of line 3)}

wideunderline[10cm]{noindent text here (in front of line 4)}

begin{tikzpicture} %without text line in front of line 5
draw (0,0) to (10,0);
end{tikzpicture}

begin{tikzpicture} %without text line in front of line 6
draw (0,0) to (10,0);
end{tikzpicture}
end{minipage}

end{document}









share|improve this question























  • In the linked question there is a comment about left alignment (tex.stackexchange.com/questions/334787/…), maybe that can help you?

    – Marijn
    5 hours ago














1












1








1








I was looking for an example here about setting the lengh of the command underline.
I'm trying to produce a text on top of a line with 10cm fixed length, with text of variable size. In addition the text should be left aligned (not centered as the examples founded here produce)
Here's a minimal example. Thank you.



documentclass[a4paper,brazil, 12pt]{report}
usepackage{amsmath,amsfonts,amscd,bezier}
usepackage{amssymb}
usepackage{babel}
usepackage[latin1]{inputenc}
usepackage[shortlabels]{enumitem}
usepackage{multicol}
usepackage{tasks}
usepackage{tikz, tkz-euclide}

%%https://tex.stackexchange.com/questions/334787/constant-length-of-underline

usepackage{eqparbox, ulem}
newcommandulmakebox[2][ULB]{eqsetminwidth{#1}{10cm}underline{eqmakebox[#1]{#2}}}

newcommand{wideunderline}[2][2em]{%
underline{makebox[ifdimwidth>#1widthelse#1fi]{#2}}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


begin{document}

begin{minipage}{5cm}
noindent (line 1) $mathbf{u+w=v+w},$

noindent (line 2) $mathbf{u+w=v+w},$

noindent (line 3) $mathbf{u+w=v+w},$

noindent (line 4) $mathbf{u+w=v+w},$

noindent (line 5) $mathbf{u+w=v+w},$

noindent (line 6) $mathbf{u+w=v+w},$
end{minipage}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%hspace*{4.4cm}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{minipage}{10cm}

underline{text here (in front of line 1) hspace{4cm}}

underline{more text here (in front of line 2) hspace{3cm}}

noindent ulmakebox{noindent(in front of line 3)}

wideunderline[10cm]{noindent text here (in front of line 4)}

begin{tikzpicture} %without text line in front of line 5
draw (0,0) to (10,0);
end{tikzpicture}

begin{tikzpicture} %without text line in front of line 6
draw (0,0) to (10,0);
end{tikzpicture}
end{minipage}

end{document}









share|improve this question














I was looking for an example here about setting the lengh of the command underline.
I'm trying to produce a text on top of a line with 10cm fixed length, with text of variable size. In addition the text should be left aligned (not centered as the examples founded here produce)
Here's a minimal example. Thank you.



documentclass[a4paper,brazil, 12pt]{report}
usepackage{amsmath,amsfonts,amscd,bezier}
usepackage{amssymb}
usepackage{babel}
usepackage[latin1]{inputenc}
usepackage[shortlabels]{enumitem}
usepackage{multicol}
usepackage{tasks}
usepackage{tikz, tkz-euclide}

%%https://tex.stackexchange.com/questions/334787/constant-length-of-underline

usepackage{eqparbox, ulem}
newcommandulmakebox[2][ULB]{eqsetminwidth{#1}{10cm}underline{eqmakebox[#1]{#2}}}

newcommand{wideunderline}[2][2em]{%
underline{makebox[ifdimwidth>#1widthelse#1fi]{#2}}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


begin{document}

begin{minipage}{5cm}
noindent (line 1) $mathbf{u+w=v+w},$

noindent (line 2) $mathbf{u+w=v+w},$

noindent (line 3) $mathbf{u+w=v+w},$

noindent (line 4) $mathbf{u+w=v+w},$

noindent (line 5) $mathbf{u+w=v+w},$

noindent (line 6) $mathbf{u+w=v+w},$
end{minipage}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%hspace*{4.4cm}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{minipage}{10cm}

underline{text here (in front of line 1) hspace{4cm}}

underline{more text here (in front of line 2) hspace{3cm}}

noindent ulmakebox{noindent(in front of line 3)}

wideunderline[10cm]{noindent text here (in front of line 4)}

begin{tikzpicture} %without text line in front of line 5
draw (0,0) to (10,0);
end{tikzpicture}

begin{tikzpicture} %without text line in front of line 6
draw (0,0) to (10,0);
end{tikzpicture}
end{minipage}

end{document}






underline






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 7 hours ago









MouraMoura

5311612




5311612













  • In the linked question there is a comment about left alignment (tex.stackexchange.com/questions/334787/…), maybe that can help you?

    – Marijn
    5 hours ago



















  • In the linked question there is a comment about left alignment (tex.stackexchange.com/questions/334787/…), maybe that can help you?

    – Marijn
    5 hours ago

















In the linked question there is a comment about left alignment (tex.stackexchange.com/questions/334787/…), maybe that can help you?

– Marijn
5 hours ago





In the linked question there is a comment about left alignment (tex.stackexchange.com/questions/334787/…), maybe that can help you?

– Marijn
5 hours ago










1 Answer
1






active

oldest

votes


















1














Not sure what's the problem. Use the [l] option for makebox.



documentclass{article}

usepackage{ulem}

newcommand{wideunderline}[2][2em]{%
uline{makebox[ifdimwidth>#1widthelse#1fi][l]{#2}}%
}

begin{document}

(line 1) wideunderline[10cm]{text here}

(line 2) wideunderline[10cm]{text here with a p}

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


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482835%2ffixing-the-length-of-underline-text%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














    Not sure what's the problem. Use the [l] option for makebox.



    documentclass{article}

    usepackage{ulem}

    newcommand{wideunderline}[2][2em]{%
    uline{makebox[ifdimwidth>#1widthelse#1fi][l]{#2}}%
    }

    begin{document}

    (line 1) wideunderline[10cm]{text here}

    (line 2) wideunderline[10cm]{text here with a p}

    end{document}


    enter image description here






    share|improve this answer




























      1














      Not sure what's the problem. Use the [l] option for makebox.



      documentclass{article}

      usepackage{ulem}

      newcommand{wideunderline}[2][2em]{%
      uline{makebox[ifdimwidth>#1widthelse#1fi][l]{#2}}%
      }

      begin{document}

      (line 1) wideunderline[10cm]{text here}

      (line 2) wideunderline[10cm]{text here with a p}

      end{document}


      enter image description here






      share|improve this answer


























        1












        1








        1







        Not sure what's the problem. Use the [l] option for makebox.



        documentclass{article}

        usepackage{ulem}

        newcommand{wideunderline}[2][2em]{%
        uline{makebox[ifdimwidth>#1widthelse#1fi][l]{#2}}%
        }

        begin{document}

        (line 1) wideunderline[10cm]{text here}

        (line 2) wideunderline[10cm]{text here with a p}

        end{document}


        enter image description here






        share|improve this answer













        Not sure what's the problem. Use the [l] option for makebox.



        documentclass{article}

        usepackage{ulem}

        newcommand{wideunderline}[2][2em]{%
        uline{makebox[ifdimwidth>#1widthelse#1fi][l]{#2}}%
        }

        begin{document}

        (line 1) wideunderline[10cm]{text here}

        (line 2) wideunderline[10cm]{text here with a p}

        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 5 hours ago









        egregegreg

        731k8819293246




        731k8819293246






























            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%2f482835%2ffixing-the-length-of-underline-text%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

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)