If I run cat("\U001F615") on the command line in RStudio on my Mac, it shows the emoji. But if I knit it (Rmd) into a pdf, I get this error message:
! Package inputenc Error: Unicode char \u8:😕 not set up for use with
LaTeX.
See the inputenc package documentation for explanation. Type H
for immediate help. ...
l.144 \end{verbatim}
Try running pandoc with --latex-engine=xelatex.
pandoc:
Error producing PDF Error: pandoc document conversion failed with
error 43 Execution halted
But if I do latex_engine: xelatex, I don't get an error message, but the knitted pdf still doesn't show the emoji. Can someone help me in how I can knit to PDF with Emoji displaying?
There is a LaTeX package that adds support for emoji here: https://github.com/alecjacobson/coloremoji.sty
I haven't had any luck installing it though, because it's not on CTAN yet and I'm a LaTeX noob!
Once it's installed, you can add something like this to your YAML header:
---
title: "Title"
author: "Me"
header-includes:
- \usepackage{coloremoji}
output:
pdf_document
---
Related
I'm using rmarkdown in rstudio and want to knit to pdf. This works well, except for when I use kable. I'm using the following yaml and it used to work in the past, but now I had to reinstall R, Rstudio and MacTex and now it doesn't work anymore.
---
title: "example"
output:
pdf_document:
df_print: kable
latex_engine: xelatex
---
```{r}
cars
```
The error message I get is:
output file: example.knit.md
! LaTeX Error: Environment kable-table undefined.
Error: LaTeX failed to compile example.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Study-1.log for more info.
Does anyone know how to solve this?
This is a bug of rmarkdown (against higher versions of Pandoc), which I just fixed on Github. Please try:
remotes::install_github('rstudio/rmarkdown')
Text is missing after convert this pdf to image(png or jpg), but there no any error log.
Use ImageMagick:
convert -density 150 -quality 100 "d:/t/pdf/fp.pdf" -alpha Remove "d:/t/pdf/5/fp.png"
Use Ghostscript (testing with version 9.23 and 9.25):
gswin64 -dSAFER -dBATCH -dNOPAUSE -r300 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=jpeg -sOutputFile=D:\t\pdf\123.jpg D:\t\pdf\fp.pdf
Anyone know what the reason and how to solve it? Thx.
PDF File for testing
image 1 image 2
There are two CIDFonts (STSong-Light and AdobeKaitiStd-Regular) used but not embedded. This means that a substitute font must be used. When run through Ghostscript this produces the following transcript:
GPL Ghostscript GIT PRERELEASE 9.26 (2018-09-13)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Can't find CID font "AdobeKaitiStd-Regular".
Attempting to substitute CID font /Adobe-GB1 for /AdobeKaitiStd-Regular, see doc
/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-GB1" is not provided either. attempting to use fa
llback CIDFont.See doc/Use.htm#CIDFontSubstitution.
Loading a TT font from %rom%Resource/CIDFSubst/DroidSansFallback.ttf to emulate
a CID font Adobe-GB1 ... Done.
Can't find CID font "AdobeKaitiStd-Regular".
Attempting to substitute CID font /Adobe-GB1 for /AdobeKaitiStd-Regular, see doc
/Use.htm#CIDFontSubstitution.
Can't find CID font "AdobeKaitiStd-Regular".
Attempting to substitute CID font /Adobe-GB1 for /AdobeKaitiStd-Regular, see doc
/Use.htm#CIDFontSubstitution.
Loading NimbusSans-Regular font from %rom%Resource/Font/NimbusSans-Regular... 71
35536 5791889 4867288 3488798 3 done.
Can't find CID font "STSong-Light".
Attempting to substitute CID font /Adobe-GB1 for /STSong-Light, see doc/Use.htm#
CIDFontSubstitution.
Loading NimbusMonoPS-Regular font from %rom%Resource/Font/NimbusMonoPS-Regular..
. 10713600 9353422 4987912 3610458 3 done.
**** Error: Executing Do inside a text block, attempting to recover
Output may be incorrect.
>>showpage, press <return> to continue<<
So you can see two fonts being substituted, and then a more concrete problem. Your PDF file executes an image operator inside a text block, which is illegal. However for me the output is apparently correct.
[EDIT]
There is some odd behaviour here. I downloaded the 64-bit release code last night and tried that, and I do see the error. The back channel transcript contains this :
Can't find CID font "AdobeKaitiStd-Regular".
Attempting to substitute CID font /Adobe-GB1 for /AdobeKaitiStd-Regular, see doc
/Use.htm#CIDFontSubstitution.
Loading NimbusSans-Regular font from %rom%Resource/Font/NimbusSans-Regular... 77
20460 6369217 2670672 1276767 3 done.
**** Error: can't process embedded font stream,
attempting to load the font using its name.
Output may be incorrect.
**** Error reading a content stream. The page may be incomplete.
Output may be incorrect.
Loading NimbusMonoPS-Regular font from %rom%Resource/Font/NimbusMonoPS-Regular..
. 11808228 10439970 2690872 1310356 3 done.
**** Error: Executing Do inside a text block, attempting to recover
Output may be incorrect.
**** Error: File did not complete the page properly and may be damaged.
Output may be incorrect.
Page 2
The key part is "Can't process embedded font stream....' That's why your text is going missing.
When I run the same command line using the current HEAD of our Git repository I don't see this error, and the file runs to completion. So it looks like this was a bug which has been fixed.
You have two options;
1) If you don't mind building the code, clone our Git repository, open the Visual Studio solution file, allow VS to update it to your version, then build Ghostscript. Use that binary.
2) As you've already discovered, don't use SAFER. I should caution you that this is a potentially dangerous setup. As long as you are processing files which you created yourself you should be fine, but please don't use this setup to process random files from untrusted sources, you could be laying yourself open to attack.
[edit 2]
And here's a third option. With 9.25 we started shipping the Resource files with Windows, just as we do with Linux. I suspect that if you add -I"c:/program files/gs/gs9.25/Resource/Init" to the beginning of your command line, it will work even when -dSAFER is true.
BTW its useful to quote the messages from the back channel when you have a problem, it may not tell you much, but it has useful information for PostScript developers.
The missing text came back when I removed the parameter -dSAFER. I don't understand why; I can't find the reason in the Ghostscript documentation.
This is my final command line:
gswin64 -dBATCH -dNOPAUSE -r150 -sDEVICE=jpeg -sOutputFile=D:\t\pdf\6\fp%03d.jpg D:\t\pdf\fp.pdf
How can I change the font color in RMarkdown pdf output.
I did try doing, Roses are \textcolor{red}{red}, violets are \textcolor{blue}{blue}.
But this only worked for the very first line in the pdf document. Upon using the same subsequently, it outputs this error,
! File ended while scanning use of \#xdblarg.
<inserted text>
\par
<*> /tmp/tex2pdf.18828/input.tex
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on /tmp/tex2pdf.18828/input.log.
pandoc: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
Execution halted
Help appreciated!
Thank you
I'm attempting to convert latex to pdf, using doxygen generated latex files. I am using Doxygen 1.8.7. However, I keep getting this error:
!LaTex Error: Unknown float option 'H'.
...
1.6 \begin<figure>[H]
I've narrowed it down to a .tex file, which contains the following:
\hypertarget{group___a_m_s___common}{\section{A\+M\+S\+\_\+\+Common}
\label{group___a_m_s___common}\index{A\+M\+S\+\_\+\+Common#{A\+M\+S\+\_\+\+Common}}
}
Collaboration diagram for A\+M\+S\+\_\+\+Common\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=334pt]{group___a_m_s___common}
\end{center}
\end{figure}
\subsection*{Modules}
\begin{DoxyCompactItemize}
\item
\hyperlink{group___common___error___codes}{A\+M\+S Common Error Codes}
\end{DoxyCompactItemize}
\subsection{Detailed Description}
Where do I go from here? Am I right in saying that it's looking for an image that it can't find?
This does indeed seem to be an issue with the float package. I had the same problem. However, just adding EXTRA_PACKAGES=float didn't fix it for me. I finally found this page which describes a conflict between the fixltx2e package and the float package which generates this error about the unknown H option. So, I commented out line 11 where it says \usepackage{fixltx2e} in the doxygen generated tex file (called refman.tex for me). Then it converted to pdf without any further problems.
As the latex error says, it's not looping for an image it can't find, but rather encountered an option to a floating element it doesn't understand. The 'H' option for float placement forces a figure to appear exactly at the place it appears in the latex code and essentially not to float. It requires the "float" package.
Thus in order to get your code working, add the following to the preamble:
\usepackage{float}
I'm not sure how to tell Doxygen that this package is required so as to not have to touch the automatically generated latex files..
In fact according to the doxygen documentation here adding the following to your configuration file should do the trick:
EXTRA_PACKAGES=float
There's a discussion on the 'H' option over here and a rather detailed discussion on latex float placement in general here.
When i am issuing the command
pdf2swf japanese.pdf -o japanese.swf -f -T 9 -t -s storeallcharacters
conversion returns an error:
Error: Unknown font tag 'HGTT_0'
Error: Unknown font tag 'HGTT_1'
Error (27721): No font in show
Error: Unknown font tag 'HGTT_1'
Error (33717): No font in show
Error: Unknown font tag 'F0'
Error (38443): No font in show
Error: Unknown character collection 'Adobe-Japan1'
Error: Couldn't find '90msp-RKSJ-H' CMap file for 'Adobe-Japan1' collection
Error: Unknown CMap '90msp-RKSJ-H' for character collection 'Adobe-Japan1'
Error: Unknown font tag 'F0'
Error (244537): No font in show
I have checked the path file for CMAP in adobe and it shows that I have Adobe-Japan1 CMAP under C:\Program Files\Adobe\Reader 10.0\Resource\CMAP.
Then what I tried so far is to download CMaps for PDF CJK Fonts in here
Download CMAP for Japan
and replaced what is under the path. I am looking everywhere for fonts 'HGTT_0, HGTT_1, F0' in the web but still no luck. I research more of the problem and found out this Japanese Font conversion problem, might have some information I missed? Please help me to understand, why is pdf2swf still report for a notice that It cannot find 'Adobe-Japan1' collection wherein I actually have it?