Discussion:
How to disable latex writer using "\texorpdfstring" on section captions
kice
2018-08-27 02:20:38 UTC
Permalink
For example:

``` markdown
## $E=mc^2$
```

convert latex using `pandoc --from markdown --to latex`, I will get

```latex
\hypertarget{emc2}{%
\subsection{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
```

which will render E=mc^2 by exporting pdf; I want to render the math
instead the code on my title.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8b558f83-c8c7-4911-8712-3871127e7e51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-27 17:09:33 UTC
Permalink
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2ftyzohwy.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Pinglai Ou
2018-08-27 18:16:38 UTC
Permalink
Since I don't need bookmark for PDF, how can I disable this feature?
Post by John MacFarlane
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLNaV%3D0rQWzfj7FdnnRsV4DJFK-DOz7jZJ%3DcQ_7Z7Gj0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-27 19:09:06 UTC
Permalink
There's no way to disable it.
You could use a custom template. Change the first
line of the default template from

\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere

to

\PassOptionsToPackage{unicode=true,bookmarks=false}{hyperref} % options for packages loaded elsewhere

This should disable bookmarks. Let us know if it
works. If it does, we may want to add a `bookmarks`
variable to the default template, so this can be
controlled more easily.
Post by Pinglai Ou
Since I don't need bookmark for PDF, how can I disable this feature?
Post by John MacFarlane
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLNaV%3D0rQWzfj7FdnnRsV4DJFK-DOz7jZJ%3DcQ_7Z7Gj0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/yh480kh8jfd3u5.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Pinglai Ou
2018-08-28 03:46:05 UTC
Permalink
Thx for your reply, but it doesn't work.
I used pandoc -D latex to get the template, changed it and then used
--template to convert markdown to LaTeX, it doesn't work.
Post by John MacFarlane
There's no way to disable it.
You could use a custom template. Change the first
line of the default template from
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
to
\PassOptionsToPackage{unicode=true,bookmarks=false}{hyperref} %
options for packages loaded elsewhere
This should disable bookmarks. Let us know if it
works. If it does, we may want to add a `bookmarks`
variable to the default template, so this can be
controlled more easily.
Post by Pinglai Ou
Since I don't need bookmark for PDF, how can I disable this feature?
Post by John MacFarlane
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLNaV%3D0rQWzfj7FdnnRsV4DJFK-DOz7jZJ%3DcQ_7Z7Gj0A%40mail.gmail.com
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2Bf%3Dk4V5RT%2BUMD-VDLve1_sChmhK6ML-TpekUq9-JOh-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-28 04:03:06 UTC
Permalink
I just tried it, and it worked fine.

pandoc -D latex > temp.latex

Edit first line of temp.latex to include
bookmarks=false in options.

pandoc --template temp.latex MANUAL.txt -o m.pdf

Outcome: m.pdf does not have bookmarks. Perhaps you
made a mistake somewhere in this process?
Post by Pinglai Ou
Thx for your reply, but it doesn't work.
I used pandoc -D latex to get the template, changed it and then used
--template to convert markdown to LaTeX, it doesn't work.
Post by John MacFarlane
There's no way to disable it.
You could use a custom template. Change the first
line of the default template from
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
to
\PassOptionsToPackage{unicode=true,bookmarks=false}{hyperref} %
options for packages loaded elsewhere
This should disable bookmarks. Let us know if it
works. If it does, we may want to add a `bookmarks`
variable to the default template, so this can be
controlled more easily.
Post by Pinglai Ou
Since I don't need bookmark for PDF, how can I disable this feature?
Post by John MacFarlane
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLNaV%3D0rQWzfj7FdnnRsV4DJFK-DOz7jZJ%3DcQ_7Z7Gj0A%40mail.gmail.com
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2Bf%3Dk4V5RT%2BUMD-VDLve1_sChmhK6ML-TpekUq9-JOh-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2ftyzm939.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Pinglai Ou
2018-08-28 05:21:51 UTC
Permalink
No, I conver to latex before render the pdf. If you directly render to pdf,
it will be fine. But sometime you need to change the latex formatting
issues.

Usage:

`pandoc -D latex > temp.latex`

edit first line of temp.latex

`pandoc --template=temp.latex -t latex -o test.tex test.md`

markdown for testing
```test.md
# $E=mc^2$
```

latex from pandoc
```test.tex
\begin{document}

\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}

\end{document}
```
Post by John MacFarlane
I just tried it, and it worked fine.
pandoc -D latex > temp.latex
Edit first line of temp.latex to include
bookmarks=false in options.
pandoc --template temp.latex MANUAL.txt -o m.pdf
Outcome: m.pdf does not have bookmarks. Perhaps you
made a mistake somewhere in this process?
Post by Pinglai Ou
Thx for your reply, but it doesn't work.
I used pandoc -D latex to get the template, changed it and then used
--template to convert markdown to LaTeX, it doesn't work.
Post by John MacFarlane
There's no way to disable it.
You could use a custom template. Change the first
line of the default template from
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages
loaded elsewhere
to
\PassOptionsToPackage{unicode=true,bookmarks=false}{hyperref} %
options for packages loaded elsewhere
This should disable bookmarks. Let us know if it
works. If it does, we may want to add a `bookmarks`
variable to the default template, so this can be
controlled more easily.
Post by Pinglai Ou
Since I don't need bookmark for PDF, how can I disable this feature?
Post by John MacFarlane
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLNaV%3D0rQWzfj7FdnnRsV4DJFK-DOz7jZJ%3DcQ_7Z7Gj0A%40mail.gmail.com
Post by Pinglai Ou
Post by John MacFarlane
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2Bf%3Dk4V5RT%2BUMD-VDLve1_sChmhK6ML-TpekUq9-JOh-A%40mail.gmail.com
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLLphLbGQ53srOz3Xzo3Nkt-qTU%3DNE6P_Z4S6GJEqs7Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-28 05:48:35 UTC
Permalink
Oh sure, your latex file will still contain the
\texorpdfstring command. But it won't generate a
bookmark in the PDF. Is it doing anything else that
you object to? Isn't it harmless?
Post by Pinglai Ou
No, I conver to latex before render the pdf. If you directly render to pdf,
it will be fine. But sometime you need to change the latex formatting
issues.
`pandoc -D latex > temp.latex`
edit first line of temp.latex
`pandoc --template=temp.latex -t latex -o test.tex test.md`
markdown for testing
```test.md
# $E=mc^2$
```
latex from pandoc
```test.tex
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
Post by John MacFarlane
I just tried it, and it worked fine.
pandoc -D latex > temp.latex
Edit first line of temp.latex to include
bookmarks=false in options.
pandoc --template temp.latex MANUAL.txt -o m.pdf
Outcome: m.pdf does not have bookmarks. Perhaps you
made a mistake somewhere in this process?
Post by Pinglai Ou
Thx for your reply, but it doesn't work.
I used pandoc -D latex to get the template, changed it and then used
--template to convert markdown to LaTeX, it doesn't work.
Post by John MacFarlane
There's no way to disable it.
You could use a custom template. Change the first
line of the default template from
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages
loaded elsewhere
to
\PassOptionsToPackage{unicode=true,bookmarks=false}{hyperref} %
options for packages loaded elsewhere
This should disable bookmarks. Let us know if it
works. If it does, we may want to add a `bookmarks`
variable to the default template, so this can be
controlled more easily.
Post by Pinglai Ou
Since I don't need bookmark for PDF, how can I disable this feature?
Post by John MacFarlane
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLNaV%3D0rQWzfj7FdnnRsV4DJFK-DOz7jZJ%3DcQ_7Z7Gj0A%40mail.gmail.com
Post by Pinglai Ou
Post by John MacFarlane
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2Bf%3Dk4V5RT%2BUMD-VDLve1_sChmhK6ML-TpekUq9-JOh-A%40mail.gmail.com
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLLphLbGQ53srOz3Xzo3Nkt-qTU%3DNE6P_Z4S6GJEqs7Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2d0u3m47g.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Pinglai Ou
2018-08-28 06:14:47 UTC
Permalink
I want to use mathematical expressions as title, like

```
# $E=mc^2$
```

but pandoc will use \texorpdfstring to make it as a plain string while I
render the latex source file converted from markdown to pdf, instead of
mathematical expressions.

You may try to directly render the markdown in the email to pdf and compare
it to "convert to latex then render it to pdf".
Post by John MacFarlane
Oh sure, your latex file will still contain the
\texorpdfstring command. But it won't generate a
bookmark in the PDF. Is it doing anything else that
you object to? Isn't it harmless?
Post by Pinglai Ou
No, I conver to latex before render the pdf. If you directly render to
pdf,
Post by Pinglai Ou
it will be fine. But sometime you need to change the latex formatting
issues.
`pandoc -D latex > temp.latex`
edit first line of temp.latex
`pandoc --template=temp.latex -t latex -o test.tex test.md`
markdown for testing
```test.md
# $E=mc^2$
```
latex from pandoc
```test.tex
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
Post by John MacFarlane
I just tried it, and it worked fine.
pandoc -D latex > temp.latex
Edit first line of temp.latex to include
bookmarks=false in options.
pandoc --template temp.latex MANUAL.txt -o m.pdf
Outcome: m.pdf does not have bookmarks. Perhaps you
made a mistake somewhere in this process?
Post by Pinglai Ou
Thx for your reply, but it doesn't work.
I used pandoc -D latex to get the template, changed it and then used
--template to convert markdown to LaTeX, it doesn't work.
Post by John MacFarlane
There's no way to disable it.
You could use a custom template. Change the first
line of the default template from
\PassOptionsToPackage{unicode=true}{hyperref} % options for
packages
Post by Pinglai Ou
Post by John MacFarlane
Post by Pinglai Ou
Post by John MacFarlane
loaded elsewhere
to
\PassOptionsToPackage{unicode=true,bookmarks=false}{hyperref} %
options for packages loaded elsewhere
This should disable bookmarks. Let us know if it
works. If it does, we may want to add a `bookmarks`
variable to the default template, so this can be
controlled more easily.
Post by Pinglai Ou
Since I don't need bookmark for PDF, how can I disable this
feature?
Post by Pinglai Ou
Post by John MacFarlane
Post by Pinglai Ou
Post by John MacFarlane
Post by Pinglai Ou
Post by John MacFarlane
Math mode is not allowed in pdf bookmarks, so this is
probably the best we can do.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it,
send
Post by Pinglai Ou
Post by John MacFarlane
Post by Pinglai Ou
Post by John MacFarlane
Post by Pinglai Ou
To post to this group, send email to
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLNaV%3D0rQWzfj7FdnnRsV4DJFK-DOz7jZJ%3DcQ_7Z7Gj0A%40mail.gmail.com
Post by Pinglai Ou
Post by John MacFarlane
Post by Pinglai Ou
Post by John MacFarlane
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2Bf%3Dk4V5RT%2BUMD-VDLve1_sChmhK6ML-TpekUq9-JOh-A%40mail.gmail.com
Post by Pinglai Ou
Post by John MacFarlane
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLLphLbGQ53srOz3Xzo3Nkt-qTU%3DNE6P_Z4S6GJEqs7Xw%40mail.gmail.com
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhL-0PmWYHz2qZJfG%3DM4obx7qwLR%3DP%2B37besWX9birqJxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-28 16:48:03 UTC
Permalink
Post by Pinglai Ou
You may try to directly render the markdown in the email to pdf and compare
it to "convert to latex then render it to pdf".
% echo '# $E=mc^2$' | pandoc -o my.tex -s
% pdflatex my.tex
% open my.pdf

Looks just fine, mathematical notation, superscript,
etc. So I'm not sure what you're talking about.

The alternative text in \texorpdfstring only affects
PDF bookmarks, not the printing text in the PDF.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2pny2l9oc.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Pinglai Ou
2018-08-28 17:17:37 UTC
Permalink
please remove the ' in echo command.

echo # $E=mc^2$ | pandoc -o my.tex -s

echo '# $E=mc^2$' will output
```
'# $E=mc^2$'
```
I dont think we need '' to quote the line in markdown.

==================================

Just in case, please save as file to try it.

save below as test.md (not including ``` mark):
```
# $E=mc^2$
```

use `pandoc -t latex -o test.tex test.md` to convert the markdown file to
latex

I think you will get:
```
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
```

Then use pandoc to render pdf: `pandoc --pdf-engine=pdflatex -o test.pdf
test.tex`

Use `pandoc --pdf-engine=pdflatex -o direct.pdf test.md` to render markdown
to pdf directly.

Compare two pdf `test.pdf` and `direct.pdf`, you will found that `test.pdf`
didnot render the math correctly.

One more things is that I cannot use pdflatex.exe to render the `test.tex`
file to pdf, you might also want to test it out.

Sorry for not making it clear.
Post by Pinglai Ou
Post by Pinglai Ou
You may try to directly render the markdown in the email to pdf and
compare
Post by Pinglai Ou
it to "convert to latex then render it to pdf".
% echo '# $E=mc^2$' | pandoc -o my.tex -s
% pdflatex my.tex
% open my.pdf
Looks just fine, mathematical notation, superscript,
etc. So I'm not sure what you're talking about.
The alternative text in \texorpdfstring only affects
PDF bookmarks, not the printing text in the PDF.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2BVM3dS-NBaOwb%3DfrcVznCXnZMmknGAeyVKd8xQq%2BdL-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-28 18:20:59 UTC
Permalink
You need the single quotes to avoid interpretation of
the $ and # by the shell. Note that # is a comment
syntax.

% echo # $E=mc^2$

will give you a blank line!

% echo "# $E=mc^2$"

will give you

# =mc^2$

because the $E is interpreted as an environment variable.
Post by Pinglai Ou
please remove the ' in echo command.
echo # $E=mc^2$ | pandoc -o my.tex -s
echo '# $E=mc^2$' will output
```
'# $E=mc^2$'
```
I dont think we need '' to quote the line in markdown.
==================================
Just in case, please save as file to try it.
```
# $E=mc^2$
```
use `pandoc -t latex -o test.tex test.md` to convert the markdown file to
latex
```
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
```
Then use pandoc to render pdf: `pandoc --pdf-engine=pdflatex -o test.pdf
test.tex`
Use `pandoc --pdf-engine=pdflatex -o direct.pdf test.md` to render markdown
to pdf directly.
Compare two pdf `test.pdf` and `direct.pdf`, you will found that `test.pdf`
didnot render the math correctly.
One more things is that I cannot use pdflatex.exe to render the `test.tex`
file to pdf, you might also want to test it out.
Sorry for not making it clear.
Post by Pinglai Ou
Post by Pinglai Ou
You may try to directly render the markdown in the email to pdf and
compare
Post by Pinglai Ou
it to "convert to latex then render it to pdf".
% echo '# $E=mc^2$' | pandoc -o my.tex -s
% pdflatex my.tex
% open my.pdf
Looks just fine, mathematical notation, superscript,
etc. So I'm not sure what you're talking about.
The alternative text in \texorpdfstring only affects
PDF bookmarks, not the printing text in the PDF.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2BVM3dS-NBaOwb%3DfrcVznCXnZMmknGAeyVKd8xQq%2BdL-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/yh480k4lfebbec.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Pinglai Ou
2018-08-28 19:19:13 UTC
Permalink
I am sorry that I assumed that you are using Windows. Would you like to try
the way I test it?

Save the file and covert to LaTeX and use pandoc to render it. More details
are in the last email.
Post by John MacFarlane
You need the single quotes to avoid interpretation of
the $ and # by the shell. Note that # is a comment
syntax.
% echo # $E=mc^2$
will give you a blank line!
% echo "# $E=mc^2$"
will give you
# =mc^2$
because the $E is interpreted as an environment variable.
Post by Pinglai Ou
please remove the ' in echo command.
echo # $E=mc^2$ | pandoc -o my.tex -s
echo '# $E=mc^2$' will output
```
'# $E=mc^2$'
```
I dont think we need '' to quote the line in markdown.
==================================
Just in case, please save as file to try it.
```
# $E=mc^2$
```
use `pandoc -t latex -o test.tex test.md` to convert the markdown file to
latex
```
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
```
Then use pandoc to render pdf: `pandoc --pdf-engine=pdflatex -o test.pdf
test.tex`
Use `pandoc --pdf-engine=pdflatex -o direct.pdf test.md` to render
markdown
Post by Pinglai Ou
to pdf directly.
Compare two pdf `test.pdf` and `direct.pdf`, you will found that
`test.pdf`
Post by Pinglai Ou
didnot render the math correctly.
One more things is that I cannot use pdflatex.exe to render the
`test.tex`
Post by Pinglai Ou
file to pdf, you might also want to test it out.
Sorry for not making it clear.
Post by Pinglai Ou
Post by Pinglai Ou
You may try to directly render the markdown in the email to pdf and
compare
Post by Pinglai Ou
it to "convert to latex then render it to pdf".
% echo '# $E=mc^2$' | pandoc -o my.tex -s
% pdflatex my.tex
% open my.pdf
Looks just fine, mathematical notation, superscript,
etc. So I'm not sure what you're talking about.
The alternative text in \texorpdfstring only affects
PDF bookmarks, not the printing text in the PDF.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2BVM3dS-NBaOwb%3DfrcVznCXnZMmknGAeyVKd8xQq%2BdL-w%40mail.gmail.com
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLft%2BMaa00rfPA5dKtSKi1vc5O6ObV_4EKFT4ky7zPNBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-28 19:50:45 UTC
Permalink
I've tried it that way too. I can't reproduce what
you're seeing in any way. I think it's likely that
you're doing something wrong, perhaps inadvertently
leaving off a character? Please check the file carefully.
Post by Pinglai Ou
I am sorry that I assumed that you are using Windows. Would you like to try
the way I test it?
Save the file and covert to LaTeX and use pandoc to render it. More details
are in the last email.
Post by John MacFarlane
You need the single quotes to avoid interpretation of
the $ and # by the shell. Note that # is a comment
syntax.
% echo # $E=mc^2$
will give you a blank line!
% echo "# $E=mc^2$"
will give you
# =mc^2$
because the $E is interpreted as an environment variable.
Post by Pinglai Ou
please remove the ' in echo command.
echo # $E=mc^2$ | pandoc -o my.tex -s
echo '# $E=mc^2$' will output
```
'# $E=mc^2$'
```
I dont think we need '' to quote the line in markdown.
==================================
Just in case, please save as file to try it.
```
# $E=mc^2$
```
use `pandoc -t latex -o test.tex test.md` to convert the markdown file to
latex
```
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
```
Then use pandoc to render pdf: `pandoc --pdf-engine=pdflatex -o test.pdf
test.tex`
Use `pandoc --pdf-engine=pdflatex -o direct.pdf test.md` to render
markdown
Post by Pinglai Ou
to pdf directly.
Compare two pdf `test.pdf` and `direct.pdf`, you will found that
`test.pdf`
Post by Pinglai Ou
didnot render the math correctly.
One more things is that I cannot use pdflatex.exe to render the
`test.tex`
Post by Pinglai Ou
file to pdf, you might also want to test it out.
Sorry for not making it clear.
Post by Pinglai Ou
Post by Pinglai Ou
You may try to directly render the markdown in the email to pdf and
compare
Post by Pinglai Ou
it to "convert to latex then render it to pdf".
% echo '# $E=mc^2$' | pandoc -o my.tex -s
% pdflatex my.tex
% open my.pdf
Looks just fine, mathematical notation, superscript,
etc. So I'm not sure what you're talking about.
The alternative text in \texorpdfstring only affects
PDF bookmarks, not the printing text in the PDF.
--
You received this message because you are subscribed to the Google
Groups "pandoc-discuss" group.
Post by Pinglai Ou
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CADvtXh%2BVM3dS-NBaOwb%3DfrcVznCXnZMmknGAeyVKd8xQq%2BdL-w%40mail.gmail.com
.
Post by Pinglai Ou
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhLft%2BMaa00rfPA5dKtSKi1vc5O6ObV_4EKFT4ky7zPNBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/yh480kefeitgmi.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-28 19:58:34 UTC
Permalink
When you use pdflatex on this tex file, don't you get
a properly typeset header? I do.

```
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
Post by Pinglai Ou
```test.tex
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/yh480kbm9mtg9h.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Pinglai Ou
2018-08-28 23:10:23 UTC
Permalink
No, it doesn't. What I got is in that email. All I got was only two lines
of latex.

Even I added the header, `pandoc --pdf-engine=pdflatex` still cannot render
the math correctly.
Post by John MacFarlane
When you use pdflatex on this tex file, don't you get
a properly typeset header? I do.
```
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
Post by Pinglai Ou
```test.tex
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhKqKQborw%3DpkN8Bpua-v2zbB-Gbmrb3A8Lb5VxP4hzWfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-08-29 00:21:55 UTC
Permalink
I'm at a loss here, we may be miscommunicating.

I'd suggest that if you want further help, put
together a zip file with the exact input file
you're using -- and custom template, if any --
and _exact_ instructions for reproducing,
and attach or link to it.
Post by Pinglai Ou
No, it doesn't. What I got is in that email. All I got was only two lines
of latex.
Even I added the header, `pandoc --pdf-engine=pdflatex` still cannot render
the math correctly.
Post by John MacFarlane
When you use pdflatex on this tex file, don't you get
a properly typeset header? I do.
```
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
Post by Pinglai Ou
```test.tex
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADvtXhKqKQborw%3DpkN8Bpua-v2zbB-Gbmrb3A8Lb5VxP4hzWfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/yh480kh8jerpi4.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
tolot27
2018-09-05 19:21:24 UTC
Permalink
It works well on my Windows machine and pandoc v2.2.3.2 with this command:

echo '# $E=mc^2$' | pandoc --pdf-engine=pdflatex -o my.pdf -s

and even with an intermediate my.tex.

--
Regards,
Mathias
Post by Pinglai Ou
No, it doesn't. What I got is in that email. All I got was only two lines
of latex.
Even I added the header, `pandoc --pdf-engine=pdflatex` still cannot
render the math correctly.
Post by John MacFarlane
When you use pdflatex on this tex file, don't you get
a properly typeset header? I do.
```
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
Post by Pinglai Ou
```test.tex
\begin{document}
\hypertarget{emc2}{%
\section{\texorpdfstring{\(E=mc^2\)}{E=mc\^{}2}}\label{emc2}}
\end{document}
```
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7db6157e-d672-4a1a-ae9b-1edb71edde14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...