<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://mark-wang.com/feed.xml" rel="self" type="application/atom+xml"/><link href="https://mark-wang.com/" rel="alternate" type="text/html" hreflang="en"/><updated>2026-05-24T20:37:46+00:00</updated><id>https://mark-wang.com/feed.xml</id><title type="html">Mark K. Wang</title><subtitle>Mark Wang&apos;s personal website. </subtitle><entry><title type="html">Transfer files with Box and lftp</title><link href="https://mark-wang.com/blog/2022/lftp/" rel="alternate" type="text/html" title="Transfer files with Box and lftp"/><published>2022-08-13T00:00:00+00:00</published><updated>2022-08-13T00:00:00+00:00</updated><id>https://mark-wang.com/blog/2022/lftp</id><content type="html" xml:base="https://mark-wang.com/blog/2022/lftp/"><![CDATA[<h3 id="outline">Outline</h3> <hr/> <ol> <li><a href="#purpose">Purpose</a></li> <li><a href="#setup">Setup and Configuration</a></li> <li><a href="#use-lftp">Using <code class="language-plaintext highlighter-rouge">lftp</code></a></li> </ol> <p><a name="purpose"></a></p> <h3 id="purpose">Purpose</h3> <hr/> <p>Transfer Box cloud storage files with the command line tool <code class="language-plaintext highlighter-rouge">lftp</code>. <code class="language-plaintext highlighter-rouge">lftp</code> is more reliable than using a web browser. It automatically handles errors, can restart interrupted transfers, and can transfer both large files and large amounts of files. <code class="language-plaintext highlighter-rouge">lftp</code> is also useful when there is no GUI available such as in an HPC environment.</p> <p><a name="setup"></a></p> <h3 id="setup-and-configuration">Setup and Configuration</h3> <hr/> <p>First install <a href="https://lftp.yar.ru"><code class="language-plaintext highlighter-rouge">lftp</code></a> on your local machine with your favorite package manager:</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>brew <span class="nb">install </span>lftp
</code></pre></div></div> <p>Then update the <code class="language-plaintext highlighter-rouge">lftp</code> config file to force strict security options.</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">mkdir</span> ~/.lftp
<span class="nv">$ </span><span class="nb">echo</span> <span class="nt">-e</span> <span class="se">\</span>
<span class="s1">'set ftps:initial-prot ""
set ftp:ssl-force true
set ftp:ssl-protect-data true'</span> <span class="o">&gt;&gt;</span> ~/.lftp/rc
</code></pre></div></div> <p>If your Box account uses <a href="https://en.wikipedia.org/wiki/Single_sign-on">SSO</a> you must create a unique password to use <code class="language-plaintext highlighter-rouge">lftp</code>. Most university Box accounts use SSO. Set a unique password from your <a href="https://box.com/account">Box account settings</a>.</p> <div class="row justify-content-center"> <div class="col-8"> <figure> <picture> <source class="responsive-img-srcset" srcset="/assets/img/box_unique_pw-480.webp 480w,/assets/img/box_unique_pw-800.webp 800w,/assets/img/box_unique_pw-1400.webp 1400w," sizes="95vw" type="image/webp"/> <img src="/assets/img/box_unique_pw.png" class="img-fluid rounded z-depth-1" width="100%" height="auto" loading="eager" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"/> </picture> </figure> </div> </div> <div class="caption"> Screenshot of the unique password Box account setting. </div> <p><a name="use-lftp"></a></p> <h3 id="using-lftp">Using <code class="language-plaintext highlighter-rouge">lftp</code></h3> <hr/> <p>Login with your Box unique password and start an <code class="language-plaintext highlighter-rouge">lftp</code> shell with the command below. Replace [Box email address] with the “Default Email Address” shown in your Box account settings.</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>lftp ftps://[Box email address]@ftp.box.com
</code></pre></div></div> <p>Upload a local directory to Box (defaults to top-level Box directory without second path)</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lftp foo@ftp.box.com:~&gt; mirror <span class="nt">-R</span> /path/to/local/directory /path/to/Box/directory
</code></pre></div></div> <p>Download a Box directory to your local machine</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lftp foo@ftp.box.com:~&gt; mirror /path/to/Box/directory /path/to/local/directory
</code></pre></div></div> <p>Upload a local file to Box (defaults to top-level Box directory without <code class="language-plaintext highlighter-rouge">-o</code> flag and argument)</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lftp foo@ftp.box.com:~&gt; put /path/to/local.file <span class="nt">-o</span> /path/to/Box/directory
</code></pre></div></div> <p>Download a Box file to your local machine (defaults to local $HOME directory without <code class="language-plaintext highlighter-rouge">-o</code> flag and argument)</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lftp foo@ftp.box.com:~&gt; get /path/to/Box.file <span class="nt">-o</span> /path/to/local/directory
</code></pre></div></div> <p>Some more useful <code class="language-plaintext highlighter-rouge">lftp</code> shell commands:</p> <table> <tbody> <tr> <td>  </td> <td><font size="+1"><b>Command</b></font></td> <td> </td> <td> </td> <td><font size="+1"><b>Description</b></font></td> </tr> <tr> <td>  </td> <td><code class="language-plaintext highlighter-rouge">ls</code></td> <td> </td> <td> </td> <td>list files in current Box directory</td> </tr> <tr> <td>  </td> <td><code class="language-plaintext highlighter-rouge">!ls</code></td> <td> </td> <td> </td> <td>list files in current local directory</td> </tr> <tr> <td>  </td> <td><code class="language-plaintext highlighter-rouge">cd</code></td> <td> </td> <td> </td> <td>change Box directory</td> </tr> <tr> <td>  </td> <td><code class="language-plaintext highlighter-rouge">lcd</code></td> <td> </td> <td> </td> <td>change local directory</td> </tr> <tr> <td>  </td> <td><code class="language-plaintext highlighter-rouge">pwd</code></td> <td> </td> <td> </td> <td>print path to current Box directory</td> </tr> <tr> <td>  </td> <td><code class="language-plaintext highlighter-rouge">lpwd</code></td> <td> </td> <td> </td> <td>print path to current local directory</td> </tr> <tr> <td>  </td> <td><code class="language-plaintext highlighter-rouge">mkdir</code></td> <td> </td> <td> </td> <td>make a folder on Box</td> </tr> </tbody> </table> <p><br/> Check out <a href="https://lftp.yar.ru/lftp-man.html">this page</a> or run <code class="language-plaintext highlighter-rouge">man lftp</code> in your terminal for a comprehensive list of commands and options. This tutorial borrows heavily from the <code class="language-plaintext highlighter-rouge">lftp</code> <a href="https://barricklab.org/twiki/bin/view/Lab/CommandLineBox">guide from the Barrick Lab </a>.</p>]]></content><author><name></name></author><category term="tutorials"/><category term="lftp"/><category term="Box"/><summary type="html"><![CDATA[Use lftp to reliably transfer large amounts of data to and from your Box account.]]></summary></entry><entry><title type="html">How I replaced Overleaf with VS Code in my LaTeX workflow</title><link href="https://mark-wang.com/blog/2022/latex/" rel="alternate" type="text/html" title="How I replaced Overleaf with VS Code in my LaTeX workflow"/><published>2022-07-17T00:00:00+00:00</published><updated>2022-07-17T00:00:00+00:00</updated><id>https://mark-wang.com/blog/2022/latex</id><content type="html" xml:base="https://mark-wang.com/blog/2022/latex/"><![CDATA[<h3 id="outline">Outline</h3> <hr/> <ol> <li><a href="#tldr">tl;dr</a></li> <li><a href="#purpose">Purpose</a></li> <li><a href="#insttex">Installing TeX Live</a></li> <li><a href="#instlat">Installing LaTeX-Workshop</a></li> <li><a href="#uselat">Using LaTeX-Workshop</a></li> <li><a href="#conlat">Configuring LaTeX-Workshop</a></li> </ol> <p><a name="tldr"></a></p> <h3 id="tldr">tl;dr</h3> <hr/> <p>Use the VS Code extension <a href="https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop">LaTeX-Workshop</a> to set up a local LaTeX environment that resembles Overleaf. You will need a local installation of <a href="https://www.tug.org/texlive/">TeX Live</a>. Read on for a more detailed guide of how to set this up.</p> <p><a name="purpose"></a></p> <h3 id="purpose-of-this-post">Purpose of this post</h3> <hr/> <p><a href="https://www.overleaf.com/">Overleaf</a> is a great online tool for editing and compiling LaTeX documents. It has useful <a href="https://www.overleaf.com/learn/how-to/Can_multiple_authors_edit_the_same_file_at_the_same_time%3F">collaboration features</a> and a surprisingly robust <a href="https://www.overleaf.com/user/subscription/plans">free tier membership</a>. However, Overleaf needs an internet connection to compile your documents. Additionally, several useful features are not available in the free tier membership:</p> <ul> <li>git integration</li> <li>cloud drive sync</li> <li>longer compile time allocations</li> </ul> <p>I have always wanted to have a local LaTeX environment so I could work offline, have free git integration, and enjoy unlimited compile time. This would also simplify syncing with a cloud drive. However, the time required to get LaTeX working offline did not seem to justify the effort to me, especially when Overleaf has such a convenient environment ready to go.<sup id="fnref:1"><a href="#fn:1" class="footnote" rel="footnote" role="doc-noteref">1</a></sup></p> <p>Recently I switched to <a href="https://code.visualstudio.com/">VS Code</a> as my editor of choice and have been exploring the extensions that it has available. I found the extension <a href="https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop">LaTeX-Workshop</a> to offer exactly what I was looking for: a local LaTeX environment with comparable convenience to Overleaf. If you’re interested in switching from Overleaf to VS Code, hopefully this post is helpful.</p> <div class="row mt-3"> <div class="col-12 mt-3 mt-md-0"> <figure> <picture> <source class="responsive-img-srcset" srcset="/assets/img/overleaf_screen-480.webp 480w,/assets/img/overleaf_screen-800.webp 800w,/assets/img/overleaf_screen-1400.webp 1400w," sizes="95vw" type="image/webp"/> <img src="/assets/img/overleaf_screen.png" class="img-fluid rounded z-depth-1" width="100%" height="auto" loading="eager" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"/> </picture> </figure> </div> <div class="col-12 mt-3 mt-md-0"> <figure> <picture> <source class="responsive-img-srcset" srcset="/assets/img/vscode_screen-480.webp 480w,/assets/img/vscode_screen-800.webp 800w,/assets/img/vscode_screen-1400.webp 1400w," sizes="95vw" type="image/webp"/> <img src="/assets/img/vscode_screen.png" class="img-fluid rounded z-depth-1" width="100%" height="auto" loading="eager" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"/> </picture> </figure> </div> </div> <div class="caption"> My Overleaf and VS Code LaTeX environments. </div> <p><a name="insttex"></a></p> <h3 id="installing-tex-live">Installing TeX Live</h3> <hr/> <p>These instructions are adapted from LaTeX-Workshop’s <a href="https://github.com/James-Yu/LaTeX-Workshop/wiki/Install#installation">excellent wiki</a>.</p> <p>In order to use LaTeX-Workshop you must first have a local installation of TeX Live. The TeX Live <a href="https://tug.org/texlive/quickinstall.html">quick install</a> worked fine on my M1 Macbook Pro. The steps I followed to install from the terminal are below. The quick install page also has directions if you are using Linux or Windows or prefer a GUI installer.</p> <p><strong>Note:</strong> the last command downloads over 7 GB onto your computer. Using the <code class="language-plaintext highlighter-rouge">--scheme=small</code> flag results in a smaller installation but does not have all of the features required by LaTeX-Workshop out of the box.</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">cd</span> /tmp <span class="c"># or wherever you prefer</span>
<span class="nv">$ </span>wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
<span class="nv">$ </span><span class="nb">tar </span>xzvf install-tl-unx.tar.gz <span class="c"># uncompress the tarball</span>
<span class="nv">$ </span><span class="nb">cd </span>install-tl-<span class="k">*</span> <span class="c"># uncompressed directory's name ends with today's YYYYMMDD date</span>
<span class="nv">$ </span><span class="nb">sudo </span>perl ./install-tl <span class="nt">--paper</span><span class="o">=</span>letter <span class="nt">--scheme</span><span class="o">=</span>full <span class="nt">--no-interaction</span> <span class="c"># install</span>
</code></pre></div></div> <p>The installation step took about two hours for me with a relatively slow internet connection. After installing I received this warning:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>*** PLEASE READ THIS WARNING ***********************************

The following (inessential) packages failed to install properly:

  skills

You can fix this by running this command:
  tlmgr update --all --reinstall-forcibly-removed
to complete the installation.

However, if the problem was a failure to download (by far the
most common cause), check that you can connect to the chosen mirror
in a browser; you may need to specify a mirror explicitly.
******************************************************************
</code></pre></div></div> <p>Which I resolved with this command:</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>tlmgr update <span class="nt">--all</span> <span class="nt">--reinstall-forcibly-removed</span> option repository http://mirror.ctan.org/systems/texlive/tlnet
</code></pre></div></div> <p>Finally, I added the path to TeX Live’s executables to my PATH environment variable. The installer will print out the path to add after a successful installation. For me this was <code class="language-plaintext highlighter-rouge">/usr/local/texlive/2022/bin/universal-darwin</code>. If you are unsure how to edit your PATH environment variable, a quick Google search should do the trick. I use <code class="language-plaintext highlighter-rouge">zsh</code>, so I added the line</p> <div class="language-zsh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="s2">"/usr/local/texlive/2022/bin/universal-darwin:</span><span class="nv">$PATH</span><span class="s2">"</span>
</code></pre></div></div> <p>to my <code class="language-plaintext highlighter-rouge">~/.zshrc</code> configuration file.</p> <p><a name="instlat"></a></p> <h3 id="installing-latex-workshop">Installing LaTeX-Workshop</h3> <hr/> <p>This part is easy. Use <a href="https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop">this link</a> or search for the “LaTeX-Workshop” extension in VS Code.</p> <p><a name="uselat"></a></p> <h3 id="using-latex-workshop">Using LaTeX-Workshop</h3> <hr/> <p>LaTeX-Workshop just worked for me after updating my PATH environment variable. If you update your PATH and are still having trouble, check out <a href="https://github.com/James-Yu/LaTeX-Workshop/wiki/Install#setting-path-environment-variable">possible solutions from the wiki</a>.</p> <p>Download one of your Overleaf projects from Overleaf’s website, unzip, and open up the main <code class="language-plaintext highlighter-rouge">.tex</code> file with VS Code. Then, you can build/compile your document by pressing <kbd>Cmd</kbd>+<kbd>Opt</kbd>+<kbd>b</kbd> (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>b</kbd> on Windows). To bring up the PDF viewer, press <kbd>Cmd</kbd>+<kbd>Opt</kbd>+<kbd>v</kbd> (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>v</kbd> on Windows).</p> <p>At this point, you can compile your documents in VS Code. In the next section I will share some optional configurations to make LaTeX-Workshop behave more like Overleaf.</p> <p><a name="conlat"></a></p> <h3 id="configuring-latex-workshop">Configuring LaTeX-Workshop</h3> <hr/> <p>LaTeX-Workshop with TeX Live worked for me right out of the box. All the packages I needed were included, including some that seem niche like <code class="language-plaintext highlighter-rouge">fontawesome5</code>. If there is a package that you don’t have locally, install it from the Comprehensive TeX Archive Network (<a href="https://www.ctan.org/search">CTAN</a>). You can use the command line tool <code class="language-plaintext highlighter-rouge">tlmgr</code> included with TeX Live:</p> <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>tlmgr <span class="nb">install</span> &lt;package1&gt; &lt;package2&gt; ...
<span class="nv">$ </span><span class="nb">sudo </span>tlmgr remove &lt;package1&gt; &lt;package2&gt; ...
</code></pre></div></div> <p>Check out the <a href="https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages">LaTeX Wikibook</a> for more info.</p> <p>Some other tips:</p> <ul> <li>To go to a PDF location's corresponding source code <kbd>Cmd</kbd>+<kbd>Click</kbd> (<kbd>Ctrl</kbd>+<kbd>Click</kbd>on Windows)</li> <li><a href="https://superuser.com/questions/1356139/enable-word-wrap-for-latex-files-only-in-vscode">Enable</a> word wrapping like Overleaf</li> <li><a href="https://marketplace.visualstudio.com/items?itemName=npxms.hide-gitignored">Hide</a> git ignored files in VS Code's explorer view</li> <li><a href="https://github.com/James-Yu/LaTeX-Workshop/wiki/View#color">Change</a> the background color of the PDF viewer</li> </ul> <hr/> <div class="footnotes" role="doc-endnotes"> <ol> <li id="fn:1"> <p>I tried <a href="https://pages.uoregon.edu/koch/texshop/">TeXShop</a> but didn’t love its UI. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p> </li> </ol> </div>]]></content><author><name></name></author><category term="tutorials"/><category term="LaTeX"/><category term="Overleaf"/><category term="VSCode"/><summary type="html"><![CDATA[A step-by-step guide showing how I set up my local LaTeX environment.]]></summary></entry></feed>