Make barcode “foots” reach the text baseline












3















With the following MWE:



documentclass{minimal}
usepackage{pst-barcode}
begin{document}
begin{pspicture}(3.5,3)
psbarcode{3-88309-455}{includetext}{isbn}
end{pspicture}
end{document}


I get a barcode like this:





So, it’s a little bit anoying, because I want the guard bars (left, middle, and right) reach the base line of the bottom numbers or go over like this:





So, is there an option in pstbarcode to force the guard lines to be longer than default behavior?










share|improve this question























  • The first image is missing. Also, it seems the default behavior is 'correct', compare for example en.wikipedia.org/wiki/Barcode.

    – Marijn
    Mar 25 at 16:37











  • So yes, but I search to get an incorrect rendering and I assume it.

    – fauve
    Mar 25 at 22:49
















3















With the following MWE:



documentclass{minimal}
usepackage{pst-barcode}
begin{document}
begin{pspicture}(3.5,3)
psbarcode{3-88309-455}{includetext}{isbn}
end{pspicture}
end{document}


I get a barcode like this:





So, it’s a little bit anoying, because I want the guard bars (left, middle, and right) reach the base line of the bottom numbers or go over like this:





So, is there an option in pstbarcode to force the guard lines to be longer than default behavior?










share|improve this question























  • The first image is missing. Also, it seems the default behavior is 'correct', compare for example en.wikipedia.org/wiki/Barcode.

    – Marijn
    Mar 25 at 16:37











  • So yes, but I search to get an incorrect rendering and I assume it.

    – fauve
    Mar 25 at 22:49














3












3








3


1






With the following MWE:



documentclass{minimal}
usepackage{pst-barcode}
begin{document}
begin{pspicture}(3.5,3)
psbarcode{3-88309-455}{includetext}{isbn}
end{pspicture}
end{document}


I get a barcode like this:





So, it’s a little bit anoying, because I want the guard bars (left, middle, and right) reach the base line of the bottom numbers or go over like this:





So, is there an option in pstbarcode to force the guard lines to be longer than default behavior?










share|improve this question














With the following MWE:



documentclass{minimal}
usepackage{pst-barcode}
begin{document}
begin{pspicture}(3.5,3)
psbarcode{3-88309-455}{includetext}{isbn}
end{pspicture}
end{document}


I get a barcode like this:





So, it’s a little bit anoying, because I want the guard bars (left, middle, and right) reach the base line of the bottom numbers or go over like this:





So, is there an option in pstbarcode to force the guard lines to be longer than default behavior?







pst-barcode






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 24 at 10:14









fauvefauve

856514




856514













  • The first image is missing. Also, it seems the default behavior is 'correct', compare for example en.wikipedia.org/wiki/Barcode.

    – Marijn
    Mar 25 at 16:37











  • So yes, but I search to get an incorrect rendering and I assume it.

    – fauve
    Mar 25 at 22:49



















  • The first image is missing. Also, it seems the default behavior is 'correct', compare for example en.wikipedia.org/wiki/Barcode.

    – Marijn
    Mar 25 at 16:37











  • So yes, but I search to get an incorrect rendering and I assume it.

    – fauve
    Mar 25 at 22:49

















The first image is missing. Also, it seems the default behavior is 'correct', compare for example en.wikipedia.org/wiki/Barcode.

– Marijn
Mar 25 at 16:37





The first image is missing. Also, it seems the default behavior is 'correct', compare for example en.wikipedia.org/wiki/Barcode.

– Marijn
Mar 25 at 16:37













So yes, but I search to get an incorrect rendering and I assume it.

– fauve
Mar 25 at 22:49





So yes, but I search to get an incorrect rendering and I assume it.

– fauve
Mar 25 at 22:49










1 Answer
1






active

oldest

votes


















1














The postscript code for producing the barcode images is located in the file pst-barcode.pro which is found in your TEXMF tree in /dvips/pst-barcode. You can copy this file to the directory of your document and then the pst-barcode package will load the local file instead of the system file.



Modify the following lines in the ean13 encoder (starting at line 1165 in my version of pst-barcode):



includetext {
/bhs [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] def
/bbs [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] def
}


into the following:



includetext {
/bhs [2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat] def
/bbs [-0.1 -0.1 12{.075}repeat -0.1 -0.1 12{.075}repeat -0.1 -0.1] def
}


Make sure you modify the right lines, there are a lot of similar lines for other encoders but this is the one for ean13 which is used by the isbn encoder.



Explanation (note this may be wrong, I don't know Postscript at all): the bhs line controls the length of the bars. It starts with two bars of length height, then twelve bars of length height-0.075, then two normal bars, etc. The second line controls the baseline of the lines, which is 0 for the first two, 0.075 for the next twelve, etc. So all you need to do is increase the length of the long bars (with the 0.1 add instruction) and lower the baseline (to -0.1 in the example).



Result:



enter image description here



It might be possible to patch the code on the fly (similar to etoolbox/xpatch) instead of copying and modifying the file, but I don't know how to do that.






share|improve this answer
























  • What is the command to find the local path of package in Unix? It seams to be latexdef but I can’t find yet a local copy of pst-barcode.

    – fauve
    Mar 28 at 10:43











  • The command is kpsewhich pst-barcode.sty (see tex.stackexchange.com/a/1138). You can also look in the terminal output or in the log file of your document to see the full path of each package used. Note that pst-barcode has a bit of a complex file structure, there is pst-barcode.sty which is a boilerplate package that loads pst-barcode.tex which is a frontend for pst-barcode.pro, each in different directories. I usually just try find . -name somefilename from /usr/share if I want to find the location of a file.

    – Marijn
    Mar 28 at 10:53












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%2f481182%2fmake-barcode-foots-reach-the-text-baseline%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














The postscript code for producing the barcode images is located in the file pst-barcode.pro which is found in your TEXMF tree in /dvips/pst-barcode. You can copy this file to the directory of your document and then the pst-barcode package will load the local file instead of the system file.



Modify the following lines in the ean13 encoder (starting at line 1165 in my version of pst-barcode):



includetext {
/bhs [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] def
/bbs [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] def
}


into the following:



includetext {
/bhs [2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat] def
/bbs [-0.1 -0.1 12{.075}repeat -0.1 -0.1 12{.075}repeat -0.1 -0.1] def
}


Make sure you modify the right lines, there are a lot of similar lines for other encoders but this is the one for ean13 which is used by the isbn encoder.



Explanation (note this may be wrong, I don't know Postscript at all): the bhs line controls the length of the bars. It starts with two bars of length height, then twelve bars of length height-0.075, then two normal bars, etc. The second line controls the baseline of the lines, which is 0 for the first two, 0.075 for the next twelve, etc. So all you need to do is increase the length of the long bars (with the 0.1 add instruction) and lower the baseline (to -0.1 in the example).



Result:



enter image description here



It might be possible to patch the code on the fly (similar to etoolbox/xpatch) instead of copying and modifying the file, but I don't know how to do that.






share|improve this answer
























  • What is the command to find the local path of package in Unix? It seams to be latexdef but I can’t find yet a local copy of pst-barcode.

    – fauve
    Mar 28 at 10:43











  • The command is kpsewhich pst-barcode.sty (see tex.stackexchange.com/a/1138). You can also look in the terminal output or in the log file of your document to see the full path of each package used. Note that pst-barcode has a bit of a complex file structure, there is pst-barcode.sty which is a boilerplate package that loads pst-barcode.tex which is a frontend for pst-barcode.pro, each in different directories. I usually just try find . -name somefilename from /usr/share if I want to find the location of a file.

    – Marijn
    Mar 28 at 10:53
















1














The postscript code for producing the barcode images is located in the file pst-barcode.pro which is found in your TEXMF tree in /dvips/pst-barcode. You can copy this file to the directory of your document and then the pst-barcode package will load the local file instead of the system file.



Modify the following lines in the ean13 encoder (starting at line 1165 in my version of pst-barcode):



includetext {
/bhs [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] def
/bbs [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] def
}


into the following:



includetext {
/bhs [2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat] def
/bbs [-0.1 -0.1 12{.075}repeat -0.1 -0.1 12{.075}repeat -0.1 -0.1] def
}


Make sure you modify the right lines, there are a lot of similar lines for other encoders but this is the one for ean13 which is used by the isbn encoder.



Explanation (note this may be wrong, I don't know Postscript at all): the bhs line controls the length of the bars. It starts with two bars of length height, then twelve bars of length height-0.075, then two normal bars, etc. The second line controls the baseline of the lines, which is 0 for the first two, 0.075 for the next twelve, etc. So all you need to do is increase the length of the long bars (with the 0.1 add instruction) and lower the baseline (to -0.1 in the example).



Result:



enter image description here



It might be possible to patch the code on the fly (similar to etoolbox/xpatch) instead of copying and modifying the file, but I don't know how to do that.






share|improve this answer
























  • What is the command to find the local path of package in Unix? It seams to be latexdef but I can’t find yet a local copy of pst-barcode.

    – fauve
    Mar 28 at 10:43











  • The command is kpsewhich pst-barcode.sty (see tex.stackexchange.com/a/1138). You can also look in the terminal output or in the log file of your document to see the full path of each package used. Note that pst-barcode has a bit of a complex file structure, there is pst-barcode.sty which is a boilerplate package that loads pst-barcode.tex which is a frontend for pst-barcode.pro, each in different directories. I usually just try find . -name somefilename from /usr/share if I want to find the location of a file.

    – Marijn
    Mar 28 at 10:53














1












1








1







The postscript code for producing the barcode images is located in the file pst-barcode.pro which is found in your TEXMF tree in /dvips/pst-barcode. You can copy this file to the directory of your document and then the pst-barcode package will load the local file instead of the system file.



Modify the following lines in the ean13 encoder (starting at line 1165 in my version of pst-barcode):



includetext {
/bhs [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] def
/bbs [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] def
}


into the following:



includetext {
/bhs [2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat] def
/bbs [-0.1 -0.1 12{.075}repeat -0.1 -0.1 12{.075}repeat -0.1 -0.1] def
}


Make sure you modify the right lines, there are a lot of similar lines for other encoders but this is the one for ean13 which is used by the isbn encoder.



Explanation (note this may be wrong, I don't know Postscript at all): the bhs line controls the length of the bars. It starts with two bars of length height, then twelve bars of length height-0.075, then two normal bars, etc. The second line controls the baseline of the lines, which is 0 for the first two, 0.075 for the next twelve, etc. So all you need to do is increase the length of the long bars (with the 0.1 add instruction) and lower the baseline (to -0.1 in the example).



Result:



enter image description here



It might be possible to patch the code on the fly (similar to etoolbox/xpatch) instead of copying and modifying the file, but I don't know how to do that.






share|improve this answer













The postscript code for producing the barcode images is located in the file pst-barcode.pro which is found in your TEXMF tree in /dvips/pst-barcode. You can copy this file to the directory of your document and then the pst-barcode package will load the local file instead of the system file.



Modify the following lines in the ean13 encoder (starting at line 1165 in my version of pst-barcode):



includetext {
/bhs [height height 12{height .075 sub}repeat height height 12{height .075 sub}repeat height height] def
/bbs [0 0 12{.075}repeat 0 0 12{.075}repeat 0 0] def
}


into the following:



includetext {
/bhs [2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat 12{height .075 sub}repeat 2{height 0.1 add}repeat] def
/bbs [-0.1 -0.1 12{.075}repeat -0.1 -0.1 12{.075}repeat -0.1 -0.1] def
}


Make sure you modify the right lines, there are a lot of similar lines for other encoders but this is the one for ean13 which is used by the isbn encoder.



Explanation (note this may be wrong, I don't know Postscript at all): the bhs line controls the length of the bars. It starts with two bars of length height, then twelve bars of length height-0.075, then two normal bars, etc. The second line controls the baseline of the lines, which is 0 for the first two, 0.075 for the next twelve, etc. So all you need to do is increase the length of the long bars (with the 0.1 add instruction) and lower the baseline (to -0.1 in the example).



Result:



enter image description here



It might be possible to patch the code on the fly (similar to etoolbox/xpatch) instead of copying and modifying the file, but I don't know how to do that.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 12:29









MarijnMarijn

8,429636




8,429636













  • What is the command to find the local path of package in Unix? It seams to be latexdef but I can’t find yet a local copy of pst-barcode.

    – fauve
    Mar 28 at 10:43











  • The command is kpsewhich pst-barcode.sty (see tex.stackexchange.com/a/1138). You can also look in the terminal output or in the log file of your document to see the full path of each package used. Note that pst-barcode has a bit of a complex file structure, there is pst-barcode.sty which is a boilerplate package that loads pst-barcode.tex which is a frontend for pst-barcode.pro, each in different directories. I usually just try find . -name somefilename from /usr/share if I want to find the location of a file.

    – Marijn
    Mar 28 at 10:53



















  • What is the command to find the local path of package in Unix? It seams to be latexdef but I can’t find yet a local copy of pst-barcode.

    – fauve
    Mar 28 at 10:43











  • The command is kpsewhich pst-barcode.sty (see tex.stackexchange.com/a/1138). You can also look in the terminal output or in the log file of your document to see the full path of each package used. Note that pst-barcode has a bit of a complex file structure, there is pst-barcode.sty which is a boilerplate package that loads pst-barcode.tex which is a frontend for pst-barcode.pro, each in different directories. I usually just try find . -name somefilename from /usr/share if I want to find the location of a file.

    – Marijn
    Mar 28 at 10:53

















What is the command to find the local path of package in Unix? It seams to be latexdef but I can’t find yet a local copy of pst-barcode.

– fauve
Mar 28 at 10:43





What is the command to find the local path of package in Unix? It seams to be latexdef but I can’t find yet a local copy of pst-barcode.

– fauve
Mar 28 at 10:43













The command is kpsewhich pst-barcode.sty (see tex.stackexchange.com/a/1138). You can also look in the terminal output or in the log file of your document to see the full path of each package used. Note that pst-barcode has a bit of a complex file structure, there is pst-barcode.sty which is a boilerplate package that loads pst-barcode.tex which is a frontend for pst-barcode.pro, each in different directories. I usually just try find . -name somefilename from /usr/share if I want to find the location of a file.

– Marijn
Mar 28 at 10:53





The command is kpsewhich pst-barcode.sty (see tex.stackexchange.com/a/1138). You can also look in the terminal output or in the log file of your document to see the full path of each package used. Note that pst-barcode has a bit of a complex file structure, there is pst-barcode.sty which is a boilerplate package that loads pst-barcode.tex which is a frontend for pst-barcode.pro, each in different directories. I usually just try find . -name somefilename from /usr/share if I want to find the location of a file.

– Marijn
Mar 28 at 10:53


















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%2f481182%2fmake-barcode-foots-reach-the-text-baseline%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?