3

In past I was using

texi2dvi("ABC.tex", pdf = TRUE)

in R to produce pdf from tex. However, after using

sudo apt-get update && sudo apt-get upgrade

Now using

texi2dvi("ABC.tex", pdf = TRUE)

throws the following error

Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  : 
  Running 'texi2dvi' on 'ABC.tex' failed.
Messages:
mkdir: cannot create directory ‘Yaseen/XYZ’: No such file or directory
/usr/bin/texi2dvi: cannot create directory: Yaseen/XYZ

My directory name contains spaces too (I can not change because many my directories have spaces in their names).

Through surfing I came across this link which says:

To build the PDF documentation, you will need a version of TeX Live or texinfo that includes texi2dvi (BEWARE: recent TeX Live, and some texinfo RPMs, do NOT include texi2dvi).

My tex --version output is

TeX 3.14159265 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.

Any help to figure out the problem will be highly appreciated. Thanks

Edited

My setwd() in R is

setwd(
  file.path(
    "/media"
    , "yaseen"
    , "D"
    , "Muhammad Yaseen"
  )
)

getwd()
[1] "/media/yaseen/D/Muhammad Yaseen"

and

texi2dvi("ABC.tex", pdf = TRUE)
9
  • what does which texi2dvi show? I'm using the same version of texlive and I have it.
    – amc
    Jul 5, 2016 at 16:01
  • 1
    In Ubuntu, texi2dvi is in the texinfo package, not in the TeX Live ones.
    – fkraiem
    Jul 5, 2016 at 16:03
  • texi2dvi is provided by the texinfo package. make sure it's installed (sudo apt-get install texinfo) see stackoverflow.com/questions/17652698/texi2dvi-command-not-found and manpages.ubuntu.com/manpages/xenial/man1/texi2dvi.1.html
    – amc
    Jul 5, 2016 at 16:03
  • Thanks @amc and fkraiem for extending your help to solve my problem. texinfo package is already installed on my machine.
    – MYaseen208
    Jul 5, 2016 at 16:05
  • are you sure this is a texi2dvi problem? the error message you posted suggests that the path you provided for the file doesn't exist. does Yaseen/XYZ exist? if not, create it first and try again.
    – amc
    Jul 5, 2016 at 16:08

1 Answer 1

2

The error message you posted suggests that the path you provided for the file doesn't exist. Does Yaseen/XYZ exist? if not, create it first and try again.

If your directory names contain spaces, try escaping them using \ in the command:

path/to\ my\ files/

Or use quotes (" / '):

"path/to my files/"

If you're doing this from R, make sure you use \\ to ensure the escape character gets passed on:

texi2dvi("/media/yaseen/D/Muhammad\\ Yaseen/ABC.tex", pdf = TRUE)

Edit: note the documentation for this in R (?texi2dvi):

There are various versions of the texi2dvi script on Unix-alikes and quite a number of bugs have been seen, some of which this R wrapper works around.

One that was present with texi2dvi version 4.8 (as supplied on OS X) is that it will not work correctly for paths which contain spaces, nor if the absolute path to a file would contain spaces.

This is obviously a dumb bug, so the best workaround is to avoid paths with spaces.

9
  • In past it was working for directory having spaces in their names. Now I have many directories with their names containing spaces and want to use texi2dvi for those directories without removing spaces in their names. Any thoughts.
    – MYaseen208
    Jul 5, 2016 at 16:12
  • I tried path/to\ my\ files/ but no success.
    – MYaseen208
    Jul 5, 2016 at 16:18
  • can you edit your question to provide the complete command in R you are using?
    – amc
    Jul 5, 2016 at 16:18
  • see my edits for setwd() and getwd() in R.
    – MYaseen208
    Jul 5, 2016 at 16:22
  • and the command to generate the pdf? try passing the complete path (with and without escape characters) to texi2dvi() instead of relying on getwd() by default.
    – amc
    Jul 5, 2016 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .