2

I have this path "~/Library/Mobile Documents/com~apple~CloudDocs/Sync/160329_3DPP.bib". I cannot change that since the .bib file is synced through iCloud and updated frequently. I read that it is advised to use filename without spaces & special characters in latex. Isn't there any workaround yet (including packages that might handle this)?

I found some old & related topics that cannot provide a working solution, such as -

MRE:

. file

\documentclass[11pt]{article} % use "amsart" instead of "article" for AMSLaTeX format %\geometry{a4paper} % ... or a4paper or a5paper or letterpaper or... \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent \usepackage[sort&compress]{natbib} \usepackage[sectionbib]{chapterbib}%bibliography after each chapter \usepackage{hyperref} \title{Title} \author{massisenergy} %\date{} % Activate to display a given date or no date \begin{document} Lorem Ipsum Odor \cite{2020FutomaThe-myth} \bibliographystyle{unsrt} \bibliography{/Users/massisenergy/Library/Mobile Documents/com~apple~CloudDocs/Sync/160329_3DPP.bib} 
  1. After running

. . . (/usr/local/texlive/2023/texmf-dist/tex/latex/base/ts1cmr.fd)

Package chapterbib Warning: The sectionbib option changes "\section *" to "\sec tion *" in \thebibliography on input line 285. (./2023_RS_AI.out) (./2023_RS_AI.out) [1] (./2023_RS_AI.bbl

Package natbib Warning: Empty `thebibliography' environment on input line 3. ) [2] (./2023_RS_AI.aux) ) Output written on 2023_RS_AI.pdf (2 pages). SyncTeX written on 2023_RS_AI.synctex.gz. Transcript written on 2023_RS_AI.log.

  1. After doing running

This is BibTeX, Version 0.99d (TeX Live 2023) The top-level auxiliary file: 2023_RS_AI.aux The style file: unsrt.bst White space in argument---line 18 of file 2023_RS_AI.aux : \bibdata{/Users/massisenergy/Library/Mobile : Documents/com\protect \unhbox \voidb@x \protect \penalty @M \ {}apple\protect \unhbox \voidb@x \protect \penalty @M \ {}CloudDocs/Sync/160329_3DPP.bib} I'm skipping whatever remains of this command I found no database files---while reading file 2023_RS_AI.aux Warning--I didn't find a database entry for "2020FutomaThe-myth" (There were 2 error messages)

11
  • 2
    It's sometimes the same using URLs with href. If the path is fix, and your lazy, you could try just to escape the special characters. That's how I manage it with my .bib file. To be honest, that's not a real solution but more of a lazy guy's workaround ;) Commented Jun 24, 2023 at 14:00
  • 4
    show a real example how you are using the path and which error you get. Commented Jun 24, 2023 at 14:12
  • 1
    I've no experience using TeX with a Mac. Is the tilde ~ a verbatim character in Apple's path's? Using Latex it means a not breakable space character. So, there may be a misinterpretation of the path. Unfortunately, I'm not at home right now and only got a smartphone, so no chance to test it... Commented Jun 24, 2023 at 14:57
  • 3
    A possible solution is to set the environment variable BIBINPUTS to include the path to the directory with the bib file. Then in the .tex file, you just use \bibliography{160329_3DPP}. Commented Jun 24, 2023 at 20:29
  • 4
    If the filename stays the same (but the content is updared) then you could also try to create a symlink to it, see tex.stackexchange.com/questions/337952/… for an example. Commented Jun 25, 2023 at 8:53

1 Answer 1

1

I wondered that this must be fairly common situation, like using multiple machines or using files which are updated & synced frequently. I'm just posting the answer from the comment by @Marijin in my question, using the following links -

This is an elegant solution, which not only solves my problem, but also provides ways to use other types of 'custom' files with LaTeX.

  1. Install & use the package: make-local-texmf
  2. Copy the directory/folder structure into my sync folder:

rsync -avh ~/Library/texmf ~/Library/Mobile\ Documents/com~apple~CloudDocs/Sync/texmf

  1. Move my bibliography file named 160329_MASTER.bib in the ~/Library/Mobile\ Documents/com~apple~CloudDocs/Sync/texmf/bibtex/bib/ folder.

  2. Delete the original folder created by make-local-texmf (otherwise running the following command will create another alias inside the ~/Library/texmf directory, like this ~/Library/texmf/texmf/)

  3. Symlink it using:

ln -s /Users/massisenergy/Library/Mobile\ Documents/com~apple~CloudDocs/Sync/texmf ~/Library/texmf

  1. MRE: + then + then twice this file:
\documentclass[11pt]{article} % use "amsart" instead of "article" for AMSLaTeX format %\geometry{a4paper} % ... or a4paper or a5paper or letterpaper or... \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent \usepackage[sort&compress]{natbib} \usepackage[sectionbib]{chapterbib}%bibliography after each chapter \usepackage{hyperref} \title{Title} \author{massisenergy} %\date{} % Activate to display a given date or no date \begin{document} Lorem Ipsum Odor \cite{2020FutomaThe-myth} \bibliographystyle{unsrt} \bibliography{MASTER_since160329.bib} 

BONUS: I was pleasantly surprised to find that even I changed my bib file name (from to 160329_3DPP.bib to MASTER_since160329.bib), still opened the right file without any error when I relaunched it! Placing the .bib file in particular directory or symlinking it must be the reason ๐Ÿ˜ƒ I'm going to move my (.sty) files also to benefit from this...

Works like a charm ๐Ÿ˜ Thanks to all the folks for your active participation & help ๐Ÿ™Œ๐Ÿฝ

3
  • Of topic: the symlink and BIBINPUTS solutions suggested do work also on current Windiows (10/11). For windows users not at ease with console, as creation of symlink is tricky and env var not obvious to set/maintain, here is a simple workaround for names/paths containing spaces. Such names have a so called 8.3 alias, shown when doing dir /x on the console. E.g. Program Files can be replaced by PROGRA~1, Program Files (x86) by PROGRA~2, "Documents and settings ` by DOCUME~1 and so on. Here ~ is not placeholder for space nor home dIrectory but the real tilde character. Commented Jun 27, 2023 at 8:43
  • Follow up of previous comment : the suggested "workaround" is usefully for many things as paths to TeX's executables interpreted by Windows but does NOT solve the OP TeX question as it unfortunately replaces the special ` ` character by a TeX's more problematic special ~ character. Commented Jun 27, 2023 at 8:53
  • Indeed, it can be a whole different situation in Windows, compared to Unix (where command line interface is relatively easy to use). Commented Jun 27, 2023 at 14:00

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.