I know it has been adressed several times, but despite many investigations and tries, I have been unabled to solve it so far.
Basically, Rmarkdown fails to render cyrillic characters where there are evaluated in inline code:
---
title: "My Title"
output: html_document
---
### Заказчик
### `r "Заказчик"`
### `r knitr::asis_output("Заказчик")`
produces
My session info is :
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 fastmap_1.1.0 htmltools_0.5.2 tools_4.1.0 yaml_2.2.1 rmarkdown_2.11 knitr_1.34 xfun_0.26
[9] digest_0.6.28 rlang_0.4.11 evaluate_0.14
Any suggestion ?
Your code works nice.
For the future, create a Rmd-file in the utf-8 encoding.
If you forgot to do that - use "file - > reopen with encoding".
Also, you can use enc2utf8
### Заказчик
### `r enc2utf8("Заказчик")`
### `r knitr::asis_output("Заказчик")`
My session info:
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
system code page: 1251
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.4.0 ggplot2_3.3.5 dplyr_1.0.7 kableExtra_1.3.4
[5] formattable_0.2.1
Related
I am trying to generate exams with exams2moodle on my new laptop. Everything worked (and still works) out perfectly fine on my old laptop, but in the new one (where I have exactly the same configuration, but there's obviously something missing), even when I try to run the simplest template with a TikZ figure in R/exams exams2moodle("automaton.Rnw") I get the error message
Error in magick_image_readpath(enc2native(path), density, depth,
strip, : rsession.exe: PDFDelegateFailed `El sistema no puede
encontrar el archivo especificado. ' # error/pdf.c/ReadPDFImage/809
I have checked my installation, and seen the various posts with similar problems, but haven't been able to fix it. Any idea what might be going wrong? Thank you very much in advance
EDIT: That's my session info
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] magick_2.4.0 mgsub_1.7.2 ICSNP_1.1-1 ICS_1.3-1 mvtnorm_1.1-1 plotrix_3.7-8
[7] Ryacas_1.1.3 FRACTION_1.0 stringr_1.4.0 Deriv_4.0.1 ggplot2_3.3.2 plot3D_1.3
[13] scatterplot3d_0.3-41 MASS_7.3-53 latex2exp_0.4.0 permute_0.9-5 mpoly_1.1.1 polynom_1.4-0
[19] pracma_2.2.9 numbers_0.7-5 exams_2.3-6
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 lattice_0.20-41 tidyr_1.1.2 assertthat_0.2.1 rprojroot_1.3-2 digest_0.6.25
[7] gmp_0.6-0 R6_2.4.1 plyr_1.8.6 backports_1.1.10 survey_4.0 evaluate_0.14
[13] pillar_1.4.6 rlang_0.4.7 misc3d_0.9-0 rstudioapi_0.11 Matrix_1.2-18 rmarkdown_2.3
[19] desc_1.2.0 splines_4.0.2 partitions_1.9-22 munsell_0.5.0 tinytex_0.26 compiler_4.0.2
[25] xfun_0.17 pkgconfig_2.0.3 htmltools_0.5.0 tcltk_4.0.2 mitools_2.4 tidyselect_1.1.0
[31] tibble_3.0.3 crayon_1.3.4 dplyr_1.0.2 withr_2.3.0 grid_4.0.2 gtable_0.3.0
[37] lifecycle_0.2.0 DBI_1.1.0 orthopolynom_1.0-5 magrittr_1.5 scales_1.1.1 stringi_1.5.3
[43] testthat_2.3.2 ellipsis_0.3.1 generics_0.0.2 vctrs_0.3.4 tools_4.0.2 glue_1.4.2
[49] purrr_0.3.4 pkgload_1.1.0 survival_3.1-12 colorspace_1.4-1 knitr_1.30
Overview
Thanks for carefully researching the problem and reporting it here. As you already worked out, the problem is not in the code within R/exams directly but with magick::image_read() which does not work correctly in some settings. Thanks also for reporting this to Jeroen Ooms, the magick maintainer.
Bug fix in magick
In response to the issue you filed, Jeroen has updated with the magick package on GitHub with new and updated ImageMagick binaries, see: https://github.com/ropensci/magick/pull/276. Please re-install magick from GitHub which should resolve the problem.
Workaround in exams
A potential workaround that avoids using magick could be to convert the TikZ PDF output to SVG instead of PNG. In that case pdf2svg (and pdfcrop) is needed to be on the PATH (see also the comments for further details). To try it use
exams2html("automaton.Rnw", svg = TRUE)
Or with exams2moodle() instead of exams2html(). (The latter is just easier for quickly inspecting the output.)
Links
Issue in the magick project on GitHub: https://github.com/ropensci/magick/issues/272.
Similar discussion in our R/exams forum on R-Forge: https://R-Forge.R-project.org/forum/forum.php?thread_id=34042&forum_id=4377&group_id=1337.
My group is using Doxygen 1.8.5 on RHEL7 to generate HTML-only documentation for a large C++ project. We only want HTML documentation and do not desire any other output format. The project's Doxygen configuration file (Doxyfile) carries the following settings which differ from the default (among others, of course):
OUTPUT_DIRECTORY="../Docs"
GENERATE_HTML=YES
GENERATE_LATEX=NO
When we run Doxygen with this config file, towards the end of processing, errors start coming to screen from LaTeX components, and processing is held up until the user hits enter a bunch of times to get past these errors, e.g.
...
sh: epstopdf: command not found
error: Problems running epstopdf. Check your TeX installation!
Generating graph info page...
Generating directory documentation...
</home/abilich/Src/GNSS_Software/Lib/LibgpsC++/>:3: warning: Found unknown command `\reference'
</home/abilich/Src/GNSS_Software/Lib/LibgpsC++/>:2: warning: Found unknown command `\reference'
</home/abilich/Src/GNSS_Software/Lib/LibgpsC++/>:2: warning: Found unknown command `\reference'
Generating bitmaps for formulas in HTML...
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
restricted \write18 enabled.
entering extended mode
(./_formulas.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo
aded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/epsfig.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/dvips.def))))
No file _formulas.aux.
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]
! Undefined control sequence.
l.53 \[ \Vert v - w \Vert \leqslant
p\,\min(\Vert v\Vert, \Vert w\Vert). \]
?
...
! Undefined control sequence.
l.533 $ \vert singular value \vert \leqslant
threshold \times \vert max sing...
?
[177] [178] (./_formulas.aux) )
Output written on _formulas.dvi (178 pages, 20576 bytes).
Transcript written on _formulas.log.
error: Problems running latex. Check your installation or look for typos in _formulas.tex and check _formulas.log!
Generating image form_0.png for formula
sh: gs: command not found
error: Problem running ghostscript gs -q -g60x50 -r384x384x -sDEVICE=ppmraw -sOutputFile=_form0.pnm -dNOPAUSE -dBATCH -- _form0.ps. Check your installation!
Generating index page...
/home/abilich/Src/GNSS_Software/Doxy/mainpage.h:15: warning: image file GNSSSoftwareTimeline.png is not found in IMAGE_PATH: assuming external image.
Generating page index...
Generating module index...
Generating namespace index...
Generating namespace member index...
I want to create a Doxyfile that runs without user intervention and does not throw LaTeX errors. Where have I gone astray?
Thanks for #albert's comment, actually the newest version of doxygen did support to turn latex generation off by setting GENERATE_LATEX=NO:
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = NO
The parameter USE_PDFLATEX in your config file should set to NO (the default value is YES)
# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
# files. Set this option to YES, to get a higher quality PDF documentation.
#
# See also section LATEX_CMD_NAME for selecting the engine.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
USE_PDFLATEX = NO
I am using the ROracle library to access an Oracle database from RStudio. Please see the code below:
drv = dbDriver("Oracle")
connect.string = paste(
"(DESCRIPTION=",
"(ADDRESS=(PROTOCOL=tcp)(HOST=", host, ")(PORT=", port, "))",
"(CONNECT_DATA=(SID=", sid, ")))", sep = "")
con = dbConnect(drv, username = "",
password = "",dbname=connect.string, encoding="latin1")
### Pull tables
keyword = dbGetQuery(con, "select COLUMN1,COLUMN2 from TABLE1")
In my column i got the words: Lørdag, søndag etc which is returned as: L?rdag, S?ndag.
R Session Info:
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringi_1.1.5 doParallel_1.0.11 iterators_1.0.8 ROracle_1.3-1 DBI_0.7 foreach_1.4.3
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2 codetools_0.2-15
Finally works! Apparently i couldnt find any way to force encoding in my code. However, i added the environment variable "NLS_LANG" and the corresponding langauge code to my operating system which fixed the issue
I have setup an inno setup script that installs my application. The resulting setup.exe will install properly on windows vista/7 but fails with the division by zero error on windows xp. The inno example scripts work on windows xp so it must be something I am doing.
Can anyone see what I am doing wrong?
; Script generated by the Inno Setup Script Wizard.
#define app_src_path "..\MyApp"
#define app_exe_path "..\bin"
#define file_ver GetFileVersion(app_exe_path + "\win32\MyApp.exe")
#define app_ver Delete(file_ver, 6, 2)
[Setup]
AppId={{BBB40316-958C-446B-A08D-311273214AA6}
AppName=MyApp
AppVersion={#app_ver}
UninstallDisplayName=MyApp
AppPublisher=My Company US
DefaultDirName={pf}\My Company\MyApp
DisableDirPage=yes
DefaultGroupName=My Company
DisableProgramGroupPage=yes
#emit 'OutputBaseFilename="MyApp-Setup-' + app_ver + '"'
#emit 'SetupIconFile="' + app_src_path + '\rc\MyAppIcon.ico"'
Compression=lzma
SolidCompression=yes
ArchitecturesInstallIn64BitMode=x64
WizardImageFile=ZDS.bmp
WizardSmallImageFile=ZDSsmall.bmp
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[InstallDelete]
Type: filesandordirs; Name: "{app}\MyApp";
[Files]
; x64 files
Source: "{#app_exe_path}\x64\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode
; win32 files
Source: "{#app_exe_path}\win32\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode
; platform independent
Source: "{#app_src_path}\rc\pic1-24.png"; DestDir: "{app}\rc"; Flags: ignoreversion nocompression
Source: "{#app_src_path}\rc\pic2-24.png"; DestDir: "{app}\rc"; Flags: ignoreversion nocompression
Source: "{#app_src_path}\rc\pic3-24.png"; DestDir: "{app}\rc"; Flags: ignoreversion nocompression
[Icons]
Name: "{group}\MyApp"; Filename: "{app}\MyApp.exe"
Name: "{commondesktop}\MyApp"; Filename: "{app}\MyApp.exe"; Tasks: desktopicon
Name: "{group}\{cm:UninstallProgram,MyApp}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\MyApp.exe"; Description: "{cm:LaunchProgram,MyApp}"; Flags: nowait postinstall skipifsilent
EDIT:
Here is the output from the /LOG
2012-07-14 10:07:50.855 Log opened. (Time zone: UTC-04:00)
2012-07-14 10:07:50.855 Setup version: Inno Setup version 5.5.1 (u)
2012-07-14 10:07:50.855 Original Setup EXE: E:\MyApp-Setup-0.0.0.exe
2012-07-14 10:07:50.855 Setup command line: /SL5="$801DE,623918,137216,E:\MyApp-Setup-0.0.0.exe" /LOG
2012-07-14 10:07:50.855 Windows version: 5.1.2600 SP3 (NT platform: Yes)
2012-07-14 10:07:50.855 64-bit Windows: No
2012-07-14 10:07:50.870 Processor architecture: x86
2012-07-14 10:07:50.870 User privileges: Administrative
2012-07-14 10:07:50.885 Exception message:
2012-07-14 10:07:50.885 Message box (OK):
Floating point division by zero.
2012-07-14 10:07:51.654 User chose OK.
2012-07-14 10:07:51.654 Deinitializing Setup.
2012-07-14 10:07:51.654 Log closed.
I don't have a [code] section so I am confused where the MessageBox (OK) message is originating from.
Supplement to Dan's answer that wouldn't fit in a comment...
For the wizard image files, I tried pretty much every possible permutation of color depth and operating system (Windows 7 and Windows XP) using GIMP 2.8 as the image editor. I came up with the following results:
It doesn't matter what color depth you use; 8-bit, 16-bit, 24-bit or 32-bit. Which makes sense when you think about it, because Windows XP does have support for 32-bit icons on the desktop. see edit below
Dan nailed it on the head when he talked about the 'corrupt' header in the bitmap. It turns out that it is not corrupt. By default, GIMP 2.8 saves 'color space information' in the header of the bitmap file. Innosetup or Windows XP (I'm not sure which) doesn't know how to properly interpret this information.
The key is to make sure that this color space information is not saved in the bitmap file. When exporting a bitmap from GIMP 2.8, you have the option to check the 'Do not write color space information' option as shown in the image below.
EDIT 2014-Mar-20
Some updated information: In InnoSetup version 5.5.4 (running and installing on Windows 7 64-bit OS), using the above method with 32-bit images gives a bitmap image is not valid error when the compiled install file is run.
Changing to a 24-bit image, still without the color space information, resolved the issue.
It turns out that the problem was the WizardImageFile and WizardImageFileSmall. Was originally using 24bit bmp files. I reduced the bit depth to 16 and now the setup will work under windows xp. This also made my install package smaller so win win.
You can use netpbm tools to convert to a bmp. ie from png:
pngtopnm icon.png | ppmtobmp - > icon.bmp
The answers above seem correct, unfortunately I ended up wasting a lot of time before I found them - and I could swear I had tried to tick gimp's "no colourspace" box. And so this is what I ended up doing instead, which can be scripted to convert many icons, and may also help someone facing the same issue.
I've been trying to install SNA packages but i always get the next errors,
> install.packages("sna")
Installing package(s) into ‘/home/rvaca/R/i486-pc-linux-gnu-library/2.14’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/sna_2.2-0.tar.gz'
Content type 'application/x-gzip' length 273329 bytes (266 Kb)
opened URL
==================================================
downloaded 266 Kb
The downloaded packages are in
‘/tmp/Rtmp7iF3Qz/downloaded_packages’
> library(sna)
starting httpd help server ... done
Error in attr(helpObj, "call") <- this.call :
attempt to set an attribute on NULL
Error: package/namespace load failed for ‘sna’
> library("sna")
Error in attr(helpObj, "call") <- this.call :
attempt to set an attribute on NULL
Error: package/namespace load failed for ‘sna’
> library('sna')
Error in attr(helpObj, "call") <- this.call :
attempt to set an attribute on NULL
Error: package/namespace load failed for ‘sna’
What happened? Thanks in advance
vacing
When loading the sna package using library(sna) or require(sna), the function .First.lib() is (still) called. This function is now among the defunct functions in the base package (see ?.First.lib), but that's beside the point.
Looking at the source files for sna, .First.lib() is defined in the file zzz.R and contains the line
ehelp <- help(package="sna")$info[[1]].
This does not work well if getOption("help_type") is not "text". You could, therefore, try setting this option before loading the package to see if that works.
options(help_type="text")
library(sna)
Does this still produce an error?
EDIT
Since the above still gives an error, and since the package has properties that are being phased out (i.e., no namespace, and using .First.lib()), I would recommend contacting the package's maintainer (perhaps with a reference to this question on SO):
packageDescription("sna")$Maintainer
Again, my suspicion is that the problem lies in creating the object ehelp in the .First.lib() function, which is called since there is no package namespace specified.
Ok this is the result of sessionInfo(), (I forgot to comment that i runs it into Eclipse)
> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: i486-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Cairo_1.5-1 igraph_0.5.5-4 rj_1.0.3-7
loaded via a namespace (and not attached):
[1] rj.gd_1.0.3-3 sna_2.2-0 tools_2.14.2