Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

You can't evaluate a man by logic alone. -- McCoy, "I, Mudd", stardate 4513.3


computers / comp.text.tex / Some mathematical symbols in the generated PDF cannot be copied correctly.

SubjectAuthor
* Some mathematical symbols in the generated PDF cannot be copied correctly.hongy...@gmail.com
`* Re: Some mathematical symbols in the generated PDF cannot be copiedScott Pakin
 `* Re: Some mathematical symbols in the generated PDF cannot be copied correctly.hongy...@gmail.com
  `- Re: Some mathematical symbols in the generated PDF cannot be copiedScott Pakin

1
Some mathematical symbols in the generated PDF cannot be copied correctly.

<caa2bcb5-d88f-4a39-9c17-f027b05227a9n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=3834&group=comp.text.tex#3834

  copy link   Newsgroups: comp.text.tex
X-Received: by 2002:a05:620a:19a2:: with SMTP id bm34mr27895006qkb.330.1625719390410;
Wed, 07 Jul 2021 21:43:10 -0700 (PDT)
X-Received: by 2002:ac8:7f83:: with SMTP id z3mr22407958qtj.12.1625719390174;
Wed, 07 Jul 2021 21:43:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.text.tex
Date: Wed, 7 Jul 2021 21:43:09 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=172.104.76.156; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 172.104.76.156
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <caa2bcb5-d88f-4a39-9c17-f027b05227a9n@googlegroups.com>
Subject: Some mathematical symbols in the generated PDF cannot be copied correctly.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Thu, 08 Jul 2021 04:43:10 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Thu, 8 Jul 2021 04:43 UTC

On Ubuntu 20.04, I've texlive 2021 installed and compile the following tex example file with latexmk:

%%%%%%%%
\documentclass{paper}

\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{braket}
\usepackage{stix}
\begin{document}

$\hat{\mathcal{H}}=-\frac{\hbar^{2}}{2 m} \int_{-\infty}^{\infty} \mathrm{d} x|x\rangle \frac{\mathrm{d}^{2}}{\mathrm{~d} x^{2}}\left\langle x\left|\otimes \mathbb{1}+\int_{-\infty}^{\infty} \mathrm{d} x\right| x\right\rangle V_{0}(x)\left\langle x\left|\otimes \mathbb{1}+\int_{-\infty}^{\infty} \mathrm{d} x\right| x\right\rangle V_{z}(x)\langle x| \otimes \hat{S}_{z}$
$\rangledownzigzagarrow$

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
%%%%%%%%

The `~/.latexmkrc' file on my side is shown below:

###
#!/usr/bin/env perl
$pdf_mode = 3;

$latex = "uplatex -synctex=1 -halt-on-error -interaction=nonstopmode %O %S";
$dvipdf = 'dvipdfmx %O -o %D %S';
$bibtex = 'upbibtex %O %S';
$makeindex = 'mendex %O -o %D %S';
$max_repeat = 5;
###

The generated PDF file is located at <https://github.com/hongyi-zhao/temp/blob/master/latex/test.pdf>. I find that some mathematical symbols in the generated PDF cannot be copied correctly. For example, the character in the PDF file corresponding to the `\hat{\mathcal{H}}' command in the source LaTeX file, when copying and pasting, will eventually become like this:  ̂ .

Any hints for this problem will be highly appreciated.

Regards,
HY

Re: Some mathematical symbols in the generated PDF cannot be copied correctly.

<ikp2jgF4itdU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=3842&group=comp.text.tex#3842

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: scott+ctt@pakin.org (Scott Pakin)
Newsgroups: comp.text.tex
Subject: Re: Some mathematical symbols in the generated PDF cannot be copied
correctly.
Date: Thu, 8 Jul 2021 13:39:22 -0600
Lines: 26
Message-ID: <ikp2jgF4itdU1@mid.individual.net>
References: <caa2bcb5-d88f-4a39-9c17-f027b05227a9n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net IZCdc9KBMl0ct1/H/2Zx3AgN+ISD+zjl9WscII8V4WFrdqUfO0
Cancel-Lock: sha1:L/PXbDkzPB0nNNQ9XW3AjynquPI=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
In-Reply-To: <caa2bcb5-d88f-4a39-9c17-f027b05227a9n@googlegroups.com>
Content-Language: en-US
 by: Scott Pakin - Thu, 8 Jul 2021 19:39 UTC

On 7/7/21 10:43 PM, hongy...@gmail.com wrote:
> I find that some mathematical symbols in the generated PDF cannot be copied correctly. For example, the character in the PDF file corresponding to the `\hat{\mathcal{H}}' command in the source LaTeX file, when copying and pasting, will eventually become like this:  ̂ .
>
> Any hints for this problem will be highly appreciated.

Personally, I'm more surprised when copy-and-paste of mathematical text
works than when it doesn't.

You can PDF's ActualText feature to specify the precise text that should
go into the clipboard. I don't remember the exact syntax offhand or if
there's a package that simplifies this (tagpdf, maybe?), but it looks
something like this:

\pdfliteral{
/Span << /ActualText (2 + 2 = 4 blah blah your text here) >>
BDC
}%
$\hat{\mathcal{H}}=-\frac{\hbar^{2}}{2 m} \int_{-\infty}^{\infty}
\mathrm{d} x|x\rangle \frac{\mathrm{d}^{2}}{\mathrm{~d}
x^{2}}\left\langle x\left|\otimes \mathbb{1}+\int_{-\infty}^{\infty}
\mathrm{d} x\right| x\right\rangle V_{0}(x)\left\langle x\left|\otimes
\mathbb{1}+\int_{-\infty}^{\infty} \mathrm{d} x\right| x\right\rangle
V_{z}(x)\langle x| \otimes \hat{S}_{z}$
\pdfliteral{EMC}

-- Scott

Re: Some mathematical symbols in the generated PDF cannot be copied correctly.

<e4230f50-31f8-4fd0-b325-1247e9e39a42n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=3844&group=comp.text.tex#3844

  copy link   Newsgroups: comp.text.tex
X-Received: by 2002:a37:59c7:: with SMTP id n190mr34290755qkb.146.1625791892312;
Thu, 08 Jul 2021 17:51:32 -0700 (PDT)
X-Received: by 2002:ac8:5c11:: with SMTP id i17mr31753316qti.64.1625791892125;
Thu, 08 Jul 2021 17:51:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.text.tex
Date: Thu, 8 Jul 2021 17:51:31 -0700 (PDT)
In-Reply-To: <ikp2jgF4itdU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=211.23.211.40; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 211.23.211.40
References: <caa2bcb5-d88f-4a39-9c17-f027b05227a9n@googlegroups.com> <ikp2jgF4itdU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e4230f50-31f8-4fd0-b325-1247e9e39a42n@googlegroups.com>
Subject: Re: Some mathematical symbols in the generated PDF cannot be copied correctly.
From: hongyi.zhao@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 09 Jul 2021 00:51:32 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: hongy...@gmail.com - Fri, 9 Jul 2021 00:51 UTC

On Friday, July 9, 2021 at 3:39:34 AM UTC+8, Scott Pakin wrote:
> On 7/7/21 10:43 PM, hongy...@gmail.com wrote:
> > I find that some mathematical symbols in the generated PDF cannot be copied correctly. For example, the character in the PDF file corresponding to the `\hat{\mathcal{H}}' command in the source LaTeX file, when copying and pasting, will eventually become like this:  ̂ .
> >
> > Any hints for this problem will be highly appreciated.
> Personally, I'm more surprised when copy-and-paste of mathematical text
> works than when it doesn't.
>
> You can PDF's ActualText feature to specify the precise text that should
> go into the clipboard. I don't remember the exact syntax offhand or if
> there's a package that simplifies this (tagpdf, maybe?), but it looks
> something like this:
>
> \pdfliteral{
> /Span << /ActualText (2 + 2 = 4 blah blah your text here) >>
> BDC
> }%
> $\hat{\mathcal{H}}=-\frac{\hbar^{2}}{2 m} \int_{-\infty}^{\infty}
> \mathrm{d} x|x\rangle \frac{\mathrm{d}^{2}}{\mathrm{~d}
> x^{2}}\left\langle x\left|\otimes \mathbb{1}+\int_{-\infty}^{\infty}
> \mathrm{d} x\right| x\right\rangle V_{0}(x)\left\langle x\left|\otimes
> \mathbb{1}+\int_{-\infty}^{\infty} \mathrm{d} x\right| x\right\rangle
> V_{z}(x)\langle x| \otimes \hat{S}_{z}$
> \pdfliteral{EMC}
>

Tried the above code, but failed:

ERROR: Undefined control sequence.

--- TeX said ---
l.12 \pdfliteral
{
--- HELP ---
TeX encountered an unknown command name. You probably misspelled the
name. If this message occurs when a LaTeX command is being processed,
the command is probably in the wrong place---for example, the error
can be produced by an \item command that's not inside a list-making
environment. The error can also be caused by a missing \documentclass
command.

> -- Scott

Re: Some mathematical symbols in the generated PDF cannot be copied correctly.

<ikracrFhni1U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=3846&group=comp.text.tex#3846

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: scott+ctt@pakin.org (Scott Pakin)
Newsgroups: comp.text.tex
Subject: Re: Some mathematical symbols in the generated PDF cannot be copied
correctly.
Date: Fri, 9 Jul 2021 10:04:37 -0600
Lines: 15
Message-ID: <ikracrFhni1U1@mid.individual.net>
References: <caa2bcb5-d88f-4a39-9c17-f027b05227a9n@googlegroups.com>
<ikp2jgF4itdU1@mid.individual.net>
<e4230f50-31f8-4fd0-b325-1247e9e39a42n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 263Qrwn1gUy5a4mObDIuYwHtTdjtb7iyJI2x/eAgxVynIDU6Nm
Cancel-Lock: sha1:EmWS7VxJtHlKNzKuX1UVZ2/NDf8=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
In-Reply-To: <e4230f50-31f8-4fd0-b325-1247e9e39a42n@googlegroups.com>
Content-Language: en-US
 by: Scott Pakin - Fri, 9 Jul 2021 16:04 UTC

On 7/8/21 6:51 PM, hongy...@gmail.com wrote:
> Tried the above code, but failed:
>
> ERROR: Undefined control sequence.
>
> --- TeX said ---
> l.12 \pdfliteral
> {

\pdfliteral is defined by pdfLaTeX. If you're using LuaLaTeX, replace
"\pdfliteral{...}" with "\pdfextension literal{...}". If you're using
XeLaTeX, then I'm not sure, but I think it's something like
"\special{pdf:literal ...}". Perhaps someone else can confirm that.

-- Scott


computers / comp.text.tex / Some mathematical symbols in the generated PDF cannot be copied correctly.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor