newcommand distorts qrcode
Clash Royale CLAN TAG#URR8PPP
up vote
6
down vote
favorite
I have found that the output of qrcode is distorted if the qrcode is placed inside of command in latex. Here below there is a MWE showing 2 qrcodes which are actually the same, one produced from within a newcommand called contact and one produced without it. I'm using the qrcode package.
The difference is noticeable and actually when I scan both codes, the one on the left is recognized as a contact and the other is not. This is the MWE:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
And the difference is actually visible. The one on the right is distorted:
I have tested this behavior under Debian Buster, both with Xelatex and Pdflatex. Both exhibit the same behavior. The question is in this case, is there anyway to solve this distortion? What is actually causing this?
Best regards,
Ch.
macros qrcode
add a comment |Â
up vote
6
down vote
favorite
I have found that the output of qrcode is distorted if the qrcode is placed inside of command in latex. Here below there is a MWE showing 2 qrcodes which are actually the same, one produced from within a newcommand called contact and one produced without it. I'm using the qrcode package.
The difference is noticeable and actually when I scan both codes, the one on the left is recognized as a contact and the other is not. This is the MWE:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
And the difference is actually visible. The one on the right is distorted:
I have tested this behavior under Debian Buster, both with Xelatex and Pdflatex. Both exhibit the same behavior. The question is in this case, is there anyway to solve this distortion? What is actually causing this?
Best regards,
Ch.
macros qrcode
1
Theqrcode
command does several changes in the category code of characters and also to the endline character. These cannot be applied ifqrcode...
is in the argument to another command (such asnewcommand
).
â egreg
37 mins ago
1
From the manual (p.5):As with all verbatim modes, however, because T E X irrevocably sets catcodes when it first encounters characters, this will not work if the qrcode macro is contained in another macro.
However, that comment refers to "special characters"...and I don't see them in your input.
â Steven B. Segletes
34 mins ago
add a comment |Â
up vote
6
down vote
favorite
up vote
6
down vote
favorite
I have found that the output of qrcode is distorted if the qrcode is placed inside of command in latex. Here below there is a MWE showing 2 qrcodes which are actually the same, one produced from within a newcommand called contact and one produced without it. I'm using the qrcode package.
The difference is noticeable and actually when I scan both codes, the one on the left is recognized as a contact and the other is not. This is the MWE:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
And the difference is actually visible. The one on the right is distorted:
I have tested this behavior under Debian Buster, both with Xelatex and Pdflatex. Both exhibit the same behavior. The question is in this case, is there anyway to solve this distortion? What is actually causing this?
Best regards,
Ch.
macros qrcode
I have found that the output of qrcode is distorted if the qrcode is placed inside of command in latex. Here below there is a MWE showing 2 qrcodes which are actually the same, one produced from within a newcommand called contact and one produced without it. I'm using the qrcode package.
The difference is noticeable and actually when I scan both codes, the one on the left is recognized as a contact and the other is not. This is the MWE:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
And the difference is actually visible. The one on the right is distorted:
I have tested this behavior under Debian Buster, both with Xelatex and Pdflatex. Both exhibit the same behavior. The question is in this case, is there anyway to solve this distortion? What is actually causing this?
Best regards,
Ch.
macros qrcode
macros qrcode
asked 51 mins ago
Charlie
551312
551312
1
Theqrcode
command does several changes in the category code of characters and also to the endline character. These cannot be applied ifqrcode...
is in the argument to another command (such asnewcommand
).
â egreg
37 mins ago
1
From the manual (p.5):As with all verbatim modes, however, because T E X irrevocably sets catcodes when it first encounters characters, this will not work if the qrcode macro is contained in another macro.
However, that comment refers to "special characters"...and I don't see them in your input.
â Steven B. Segletes
34 mins ago
add a comment |Â
1
Theqrcode
command does several changes in the category code of characters and also to the endline character. These cannot be applied ifqrcode...
is in the argument to another command (such asnewcommand
).
â egreg
37 mins ago
1
From the manual (p.5):As with all verbatim modes, however, because T E X irrevocably sets catcodes when it first encounters characters, this will not work if the qrcode macro is contained in another macro.
However, that comment refers to "special characters"...and I don't see them in your input.
â Steven B. Segletes
34 mins ago
1
1
The
qrcode
command does several changes in the category code of characters and also to the endline character. These cannot be applied if qrcode...
is in the argument to another command (such as newcommand
).â egreg
37 mins ago
The
qrcode
command does several changes in the category code of characters and also to the endline character. These cannot be applied if qrcode...
is in the argument to another command (such as newcommand
).â egreg
37 mins ago
1
1
From the manual (p.5):
As with all verbatim modes, however, because T E X irrevocably sets catcodes when it first encounters characters, this will not work if the qrcode macro is contained in another macro.
However, that comment refers to "special characters"...and I don't see them in your input.â Steven B. Segletes
34 mins ago
From the manual (p.5):
As with all verbatim modes, however, because T E X irrevocably sets catcodes when it first encounters characters, this will not work if the qrcode macro is contained in another macro.
However, that comment refers to "special characters"...and I don't see them in your input.â Steven B. Segletes
34 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
6
down vote
To quote the QR-code documentation:
As with all verbatim modes, however, because TEX irrevocably sets
catcodes when it first encounters characters, this will not work if
the qrcode macro is contained in another macro. If you call qrcode
inside an fbox or a marginpar, for example, and if your URL contains
one of those special characters, you will either encounter error
messages or (worse, because it is undetectable to the naked eye) have
the wrong QR code typeset. In this scenario, you can still include any
of the characters #$&^_~% by escaping them with an extra
backslash; so long as they eventually pass unexpanded to qrcode, they
will produce the correct QR code. A line break may be obtained with
?.
So it is caused by the line breaks and the spaces (the indention). You can fix it by replacing the line breaks with ?
.
An example with identical barcodes:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode?%
BEGIN:VCARD?%
VERSION:4.0?%
EMAIL:john.doe@doe.net?%
FN:John Doe?%
N:Doe;John;;;?%
TEL;TYPE=home:123456789?%
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d?%
URL:www.doe.net?%
END:VCARD?%
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
To quote the QR-code documentation:
As with all verbatim modes, however, because TEX irrevocably sets
catcodes when it first encounters characters, this will not work if
the qrcode macro is contained in another macro. If you call qrcode
inside an fbox or a marginpar, for example, and if your URL contains
one of those special characters, you will either encounter error
messages or (worse, because it is undetectable to the naked eye) have
the wrong QR code typeset. In this scenario, you can still include any
of the characters #$&^_~% by escaping them with an extra
backslash; so long as they eventually pass unexpanded to qrcode, they
will produce the correct QR code. A line break may be obtained with
?.
So it is caused by the line breaks and the spaces (the indention). You can fix it by replacing the line breaks with ?
.
An example with identical barcodes:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode?%
BEGIN:VCARD?%
VERSION:4.0?%
EMAIL:john.doe@doe.net?%
FN:John Doe?%
N:Doe;John;;;?%
TEL;TYPE=home:123456789?%
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d?%
URL:www.doe.net?%
END:VCARD?%
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
add a comment |Â
up vote
6
down vote
To quote the QR-code documentation:
As with all verbatim modes, however, because TEX irrevocably sets
catcodes when it first encounters characters, this will not work if
the qrcode macro is contained in another macro. If you call qrcode
inside an fbox or a marginpar, for example, and if your URL contains
one of those special characters, you will either encounter error
messages or (worse, because it is undetectable to the naked eye) have
the wrong QR code typeset. In this scenario, you can still include any
of the characters #$&^_~% by escaping them with an extra
backslash; so long as they eventually pass unexpanded to qrcode, they
will produce the correct QR code. A line break may be obtained with
?.
So it is caused by the line breaks and the spaces (the indention). You can fix it by replacing the line breaks with ?
.
An example with identical barcodes:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode?%
BEGIN:VCARD?%
VERSION:4.0?%
EMAIL:john.doe@doe.net?%
FN:John Doe?%
N:Doe;John;;;?%
TEL;TYPE=home:123456789?%
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d?%
URL:www.doe.net?%
END:VCARD?%
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
add a comment |Â
up vote
6
down vote
up vote
6
down vote
To quote the QR-code documentation:
As with all verbatim modes, however, because TEX irrevocably sets
catcodes when it first encounters characters, this will not work if
the qrcode macro is contained in another macro. If you call qrcode
inside an fbox or a marginpar, for example, and if your URL contains
one of those special characters, you will either encounter error
messages or (worse, because it is undetectable to the naked eye) have
the wrong QR code typeset. In this scenario, you can still include any
of the characters #$&^_~% by escaping them with an extra
backslash; so long as they eventually pass unexpanded to qrcode, they
will produce the correct QR code. A line break may be obtained with
?.
So it is caused by the line breaks and the spaces (the indention). You can fix it by replacing the line breaks with ?
.
An example with identical barcodes:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode?%
BEGIN:VCARD?%
VERSION:4.0?%
EMAIL:john.doe@doe.net?%
FN:John Doe?%
N:Doe;John;;;?%
TEL;TYPE=home:123456789?%
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d?%
URL:www.doe.net?%
END:VCARD?%
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
To quote the QR-code documentation:
As with all verbatim modes, however, because TEX irrevocably sets
catcodes when it first encounters characters, this will not work if
the qrcode macro is contained in another macro. If you call qrcode
inside an fbox or a marginpar, for example, and if your URL contains
one of those special characters, you will either encounter error
messages or (worse, because it is undetectable to the naked eye) have
the wrong QR code typeset. In this scenario, you can still include any
of the characters #$&^_~% by escaping them with an extra
backslash; so long as they eventually pass unexpanded to qrcode, they
will produce the correct QR code. A line break may be obtained with
?.
So it is caused by the line breaks and the spaces (the indention). You can fix it by replacing the line breaks with ?
.
An example with identical barcodes:
documentclass[border=1cm]standalone
usepackageqrcode
newcommandcontact
qrcode?%
BEGIN:VCARD?%
VERSION:4.0?%
EMAIL:john.doe@doe.net?%
FN:John Doe?%
N:Doe;John;;;?%
TEL;TYPE=home:123456789?%
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d?%
URL:www.doe.net?%
END:VCARD?%
begindocument
qrcode
BEGIN:VCARD
VERSION:4.0
EMAIL:john.doe@doe.net
FN:John Doe
N:Doe;John;;;
TEL;TYPE=home:123456789
UID:8cbddd73-d45d-45ad-a1e4-9587984e880d
URL:www.doe.net
END:VCARD
contact
enddocument
answered 31 mins ago
Marcel Krüger
10.4k11032
10.4k11032
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f451286%2fnewcommand-distorts-qrcode%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
The
qrcode
command does several changes in the category code of characters and also to the endline character. These cannot be applied ifqrcode...
is in the argument to another command (such asnewcommand
).â egreg
37 mins ago
1
From the manual (p.5):
As with all verbatim modes, however, because T E X irrevocably sets catcodes when it first encounters characters, this will not work if the qrcode macro is contained in another macro.
However, that comment refers to "special characters"...and I don't see them in your input.â Steven B. Segletes
34 mins ago