{"id":2797,"date":"2022-04-10T15:05:38","date_gmt":"2022-04-10T15:05:38","guid":{"rendered":"https:\/\/www.scijournal.org\/articles\/?p=2797"},"modified":"2022-07-14T02:28:16","modified_gmt":"2022-07-13T18:28:16","slug":"absolute-value-symbol-in-latex","status":"publish","type":"post","link":"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex","title":{"rendered":"How to create an absolute value symbol in LaTeX?"},"content":{"rendered":"\n<p><em>This article aims to show you a simple way to create an <\/em><em>absolute value symbol in LaTeX<\/em><em>.<\/em><\/p>\n\n\n\n<p>By definition, the absolute value or modulus is the non-negative value of x without regard to its sign. But if you need to insert it in your LaTeX documents, today you will learn how to do it.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_67_1 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69dddd1a0787d\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69dddd1a0787d\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex\/#Absolute_Value_Symbol\" title=\"Absolute Value Symbol\">Absolute Value Symbol<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex\/#Absolute_Value_mid\" title=\"Absolute Value \\mid&nbsp;\">Absolute Value \\mid&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex\/#Absolute_Value_Lines\" title=\"Absolute Value Lines\">Absolute Value Lines<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex\/#Absolute_Value_Vertical_Commands\" title=\"Absolute Value Vertical Commands\">Absolute Value Vertical Commands<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex\/#Resizable_Value_Symbol\" title=\"Resizable Value Symbol\">Resizable Value Symbol<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex\/#Further_Reading\" title=\"Further Reading\">Further Reading<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Absolute_Value_Symbol\"><\/span><strong>Absolute Value Symbol<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The most common way to represent the absolute value symbol is using two vertical lines on each side of the expression. For example<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"449\" height=\"81\" src=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image4-11.png\" alt=\"absolute value symbol in LaTeX\" class=\"wp-image-2798\" srcset=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image4-11.png 449w, https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image4-11-300x54.png 300w\" sizes=\"(max-width: 449px) 100vw, 449px\" \/><figcaption>Absolute value symbol<\/figcaption><\/figure><\/div>\n\n\n<p>There are many commands of ways to insert the absolute value, but in this article, we will focus on the most common ways to write the symbol.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Absolute_Value_mid\"><\/span><strong>Absolute Value \\mid&nbsp;<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The first option is using the command \\mid, it generates a vertical line where you type it, therefore you will need two \\mid commands for the absolute value, it requires math mode enabled. For example<\/p>\n\n\n\n<p>\\begin{document}<\/p>\n\n\n\n<p>Absolute using $\\backslash$mid $\\mid x+y \\mid$<\/p>\n\n\n\n<p>\\end{document}<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"429\" height=\"67\" src=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image6-9.png\" alt=\"absolute value symbol in LaTeX\" class=\"wp-image-2801\" srcset=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image6-9.png 429w, https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image6-9-300x47.png 300w\" sizes=\"(max-width: 429px) 100vw, 429px\" \/><figcaption>\\mid output<\/figcaption><\/figure><\/div>\n\n\n<p>The \\mid command has bigger blank spaces on the argument of the absolute value, this is my go-to option to write inline equations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Absolute_Value_Lines\"><\/span><strong>Absolute Value Lines<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The second option is using the key \u201c|\u201d, your keyboard has it but you can also write it by typing alt + 124. It goes to each side of the argument of the absolute value, and it requires the math mode. As you can see absolute value symbol is not an actual command but rather just a key.&nbsp;<\/p>\n\n\n\n<p>For example,&nbsp;<\/p>\n\n\n\n<p>\\begin{document}<\/p>\n\n\n\n<p>Absolute value using &#8220;$|$\u201d $|x+z|$<\/p>\n\n\n\n<p>\\end{document}<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"82\" src=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image5-10.png\" alt=\"absolute value symbol in LaTeX\" class=\"wp-image-2802\" srcset=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image5-10.png 473w, https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image5-10-300x52.png 300w\" sizes=\"(max-width: 473px) 100vw, 473px\" \/><figcaption>\u201c|\u201d output has no space between the lines and the argument<\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Absolute_Value_Vertical_Commands\"><\/span><strong>Absolute Value Vertical Commands<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can also use two commands to create the vertical lines on each side, for the left side you use the command \\lvert, and for the right side \\rvert, both commands require importing the amsmath package. For example<\/p>\n\n\n\n<p>\\documentclass{article}<\/p>\n\n\n\n<p>\\usepackage{amsmath}<\/p>\n\n\n\n<p>\\begin{document}<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;Absolute value using $\\backslash$lvert and $\\backslash$rvert<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;$$\\lvert y + 3 \\rvert$$<\/p>\n\n\n\n<p>\\end{document}<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"146\" src=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image2-14.png\" alt=\"absolute value symbol in LaTeX\" class=\"wp-image-2803\" srcset=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image2-14.png 569w, https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image2-14-300x77.png 300w\" sizes=\"(max-width: 569px) 100vw, 569px\" \/><figcaption>Left and right vertical bars output<\/figcaption><\/figure><\/div>\n\n\n<p>\\lvert stands for left vertical, and \\rvert for right vertical. As you can see these commands don\u2019t have a lot of blank space for the argument of the absolute value.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Resizable_Value_Symbol\"><\/span><strong>Resizable Value Symbol<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To this point we have only used inline equation, but what about including integrals or summation, you can use all of the options above, for example<\/p>\n\n\n\n<p>\\documentclass{article}<\/p>\n\n\n\n<p>\\usepackage{amsmath}<\/p>\n\n\n\n<p>\\begin{document}<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;$$|\\int x^2 dx|$$<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;$$\\mid \\sum_{i=0}^{\\infty} \\dfrac{x_{i}}{x^2 + 4} \\mid$$<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;$$\\lvert \\dfrac{x^3+x^2+x+6}{x-9} \\rvert$$<\/p>\n\n\n\n<p>\\end{document}<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"284\" height=\"315\" src=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image1-15.png\" alt=\"absolute value symbol in LaTeX\" class=\"wp-image-2804\" srcset=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image1-15.png 284w, https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image1-15-270x300.png 270w\" sizes=\"(max-width: 284px) 100vw, 284px\" \/><figcaption>Not resizable vertical bars<\/figcaption><\/figure><\/div>\n\n\n<p>As you can see, the vertical bars on each side of the expressions do not have the same height as the argument. To solve this you have to use two commands \\left and \\right, just before inserting the vertical bars, let\u2019s recreate the example above but using these two new commands,<\/p>\n\n\n\n<p>\\documentclass{article}<\/p>\n\n\n\n<p>\\usepackage{amsmath}<\/p>\n\n\n\n<p>\\begin{document}<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;$$\\left | \\int x^2 dx \\right |$$<\/p>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;$$\\left \\lvert \\dfrac{x^3+x^2+x+6}{x-9} \\right \\rvert$$<\/p>\n\n\n\n<p>\\end{document}<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"290\" height=\"231\" src=\"https:\/\/www.scijournal.org\/articles\/wp-content\/uploads\/2022\/04\/image3-13.png\" alt=\"absolute value symbol in LaTeX\" class=\"wp-image-2805\"\/><figcaption>Resizable vertical bars<\/figcaption><\/figure><\/div>\n\n\n<p>You may be probably noticing that the \\mid command is missing, and that\u2019s because the \\left and \\right commands don\u2019t work with the \\mid command.<\/p>\n\n\n\n<p>Now you have it, all the knowledge you may need to correctly write the absolute value symbols in different ways in your LaTeX document, remember you can always look at the documentation of the packages (<a href=\"https:\/\/ctan.org\/pkg\/amsmath\" target=\"_blank\" rel=\"noopener\">amsmath<\/a>).<\/p>\n\n\n\n<p>I hope this tutorial was helpful in guiding you in LaTeX, and as always keep writing in LaTeX.&nbsp;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Further_Reading\"><\/span><strong>Further Reading<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>LaTex Tutorial<\/strong> <strong>on Symbols<\/strong><\/p>\n\n\n\n<ol><li><a href=\"https:\/\/www.scijournal.org\/articles\/cross-product-symbol-in-latex\">How To Create A Cross Product Symbol In LaTeX<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/hat-symbol-in-latex\">How to create a hat symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/prime-symbol-in-latex\">How to create a prime symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/approximate-symbol-in-latex\">How to create an approximate symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/intersection-symbol-in-latex\">How to create an intersection symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/empty-set-symbol-in-latex\">How to create the empty set symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/degree-symbol-in-latex\">How to write a degree symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/dot-product-in-latex\">How to write a dot product in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/greater-than-symbol-in-latex\">How to Write a Greater Than Symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/norm-symbol-in-latex\">How to write a norm symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/plus-minus-symbol-in-latex\">How to write A Plus-Minus Symbol in LaTeX<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/proportional-to-symbol-in-latex\">How to write a proportional to symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/real-number-symbol-in-latex\">How to write a real number symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/tilde-symbol-in-latex\">How to write a tilde symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/union-symbol-in-latex\">How to write a union symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/vector-in-latex\">How to write a vector in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/infinity-symbol-in-latex\">How to write an infinity symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/bold-text-in-latex\">How to write bold text in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/dots-symbols-in-latex\">How To Write Dots Symbols In LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/arrow-symbols-in-latex\">How to write the arrow symbols in LaTeX<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/degree-celsius-symbol-in-latex\">How to write the Degree celsius symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/equal-or-not-equal-symbol-in-latex\">How to write the equal or not equal symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/euro-symbol-in-latex\">How to write the Euro symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/floor-symbol-in-latex\">How to write the floor symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/gradient-operator-symbol-in-latex\">How to write the gradient operator symbol in LaTeX<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/greater-than-or-equal-to-symbol-in-latex\">How To Write The Greater Than Or Equal To Symbol In LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/integer-number-symbol-in-latex\">How to write the integer number symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/less-than-symbol-in-latex\">How to write the less than symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/natural-numbers-symbol-in-latex\">How to write the Natural numbers symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/parallel-symbol-in-latex\">How to write the parallel symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/percent-symbol-in-latex\">How to write the percent symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/square-root-symbol-in-latex\">How to write the square root symbol in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/subset-in-latex\">How To Write The Symbol For A Subset In LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/therefore-in-latex\">How to write the symbol for therefore in LaTeX?<\/a><\/li><li><a href=\"https:\/\/www.scijournal.org\/articles\/mathbb-command-in-latex\">How to write with the mathbb in LaTeX?<\/a><\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This article aims to show you a simple way to create an absolute value symbol in LaTeX. By definition, the absolute value or modulus is the non-negative value of x without regard to its sign. But if you need to insert it in your LaTeX documents, today you will learn how to do it. Absolute &#8230; <a title=\"How to create an absolute value symbol in LaTeX?\" class=\"read-more\" href=\"https:\/\/www.scijournal.org\/articles\/absolute-value-symbol-in-latex\" aria-label=\"Read more about How to create an absolute value symbol in LaTeX?\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":2806,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[39],"_links":{"self":[{"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/posts\/2797"}],"collection":[{"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/comments?post=2797"}],"version-history":[{"count":3,"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/posts\/2797\/revisions"}],"predecessor-version":[{"id":5607,"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/posts\/2797\/revisions\/5607"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/media\/2806"}],"wp:attachment":[{"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/media?parent=2797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/categories?post=2797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scijournal.org\/articles\/wp-json\/wp\/v2\/tags?post=2797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}