What do I need to do to "register" 'latexpdf' for Sphinx? - latex

When I run Sphinx using 'latexpdf' I get an error, even though I have a complete working TeX installation on my machine:
Sphinx error: Builder name latexpdf not registered
What do I need to do to "register" latexpdf?

latexpdf is not a Sphinx builder; it is the name of a target in the Makefile created by sphinx-quickstart. This target uses the latex builder.
Executing sphinx-build -b latexpdf . _build produces the error in the question (as expected).
If you run make latexpdf, it works.
PyCharm was mentioned in a comment and the problem seems to stem from that program. The following is run when latexpdf is configured as a "Command" (Sphinx task):
sphinx_runner.py -b latexpdf <indir> <outdir>
The sphinx_runner.py script is very similar to sphinx_build (a wrapper for sphinx.cmdline.main()). Since the -b option is supposed provide the name of an actual builder, there is an error.

Use -M instead of -b. This invokes sphinx-build similarly to make latexpdf, e.g.:
sphinx-build -M latexpdf . _build
See #mzjn's answer for details.

Now have Pycharm 2016.3 generating a pdf form me based on information here: https://www.quora.com/How-to-create-a-PDF-out-of-Sphinx-documentation-tool
Install rst2pdf:
pip install rst2pdf
Edit a new Python Docs sphinx configuration and choose pdf as the command. Set input directory and directory to hold .pdf as output.
Edit the conf.py file and add the two lines that mention pdf:
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'rst2pdf.pdfbuilder'
]
pdf_documents = [('index', u'documentation', My Docs', u'Me'), ]
Now run the configuration and you should get a file called documentation.pdf in the output directory.

If you are interested in a pure Python solution, the following works for me:
import sphinx.cmd.make_mode as sphinx_build
OUT_DIR = "docs" # here you have your conf.py etc
build_output = os.path.join(OUT_DIR, "_build")
# build HTML (same as `make html`)
build_html_args = ["html", OUT_DIR, build_output]
sphinx_build.run_make_mode(args=build_html_args)
# build PDF latex (same as `make latexpdf`)
build_pdf_args = ["latexpdf", OUT_DIR, build_output]
sphinx_build.run_make_mode(args=build_pdf_args)
In fact, I've made a complete Python3 script that given a few convenient arguments generates the whole package documentation as HTML and PDF from scratch, with the RTD theme. It can be pretty handy if you want it to run it on different OS or Python interpreters (in my case i wanted to run it within Blender), or adapt it to your needs. It still has some dirty spots, due to some variables being hardcoded into conf.py. Let me know if you see any issues with it!
This is how it looks like:
HTML
PDF
Cheers,
Andres

Related

Convert iOS project to 64 bit using ConvertCocoa64 script

I need to convert my iOS project to 64-bit friendly (to get rid of compiler warnings, as in this question. The solution apparently is to run ConvertCocoa64.
I've managed to locate ConvertCocoa64 (which is no longer included in /Developer/Extras/64BitConversion/ConvertCocoa64) as the Apple docs suggest, but here (search for Auxiliary Tools)
So I've download the script. But my question is, how do I run this on my project? Please assume a total newbie level of knowledge here when it comes to the terminal and running scripts. Do I drop the script inside my project folder and just double click it? Or do I access it from the terminal? The docs say run this command:
/Developer/Extras/64BitConversion/ConvertCocoa64 `find . -name '*.[hm]' | xargs`
But since that folder doesn't exist, where do I run it?. I tried dropping the script in the Developer folder, but when I type ConvertCocoa64 it says command not found.
Find where the command is located now. You'll want to run it in the terminal using the full path to the command, as in your example, just with the real path.
A good way to get the full path is to locate the command in the Finder and drag it to an open terminal window - this also "escapes" any spaces in the path for you. The easiest way to hit all your files as arguments to the command is to cd (change directory) to your project first (in the terminal).
This should get you set up to follow the directions you have.
If I'm not mistaking, to run script, you should place dot . before command. Doesn't really matters, where script is situated as long, as it doesn't rely on it heavily
> cd ~/path/to/script/dir/
> ./ConvertCocoa64 ...

Sublime Text 3 LaTeXTools plugin won't compile on Debian

When doing Ctrl+B on SublimeText3, the following error is output:
[Compiling first.tex]
TraditionalBuilder: Invoking latexmk...
COULD NOT COMPILE!
Attempted command:latexmk -cd -e $pdflatex='pdflatex -interaction=nonstopmode -synctex=1 %S %O' -f -pdf first.tex
Build engine: Traditional Builder
Running the exact same command compiles a pdf file just fine.
This answer does not solve the problem, as I've
Removed spaces around "="
Done a "Reconfigure LaTeXTools and migrate settings".
Made sure pdflatex is installed.
Made sure the path for texpath is correct.
If your command runs on terminal then most likely there is an issue either with the path or with the command itself (in the file). There has been some update to the README file by the developer:
some distros do not want a space before and after the = in $pdflatex = %E. But some do want the space there (sigh!)
sometimes latexmk is not on the PATH, or the path is not correctly picked up by ST. In this case, instead of "latexmk", use "/usr/bin/latexmk" or wherever latexmk is in your system.
some distros require quoting the $pdflatex assignment, as in "$pdflatex = \"'%E -interaction=nonstopmode -synctex=1 %S %O'\""
So it might take a while but you'll find it eventually in the settings or the traditionalbuilder.py file.
Also when I tried putting /usr/bin/latexmk, latex did not produce the correct pdf (I checked it with few changes and it just opened the old pdf) but in your case it might work.
Also, at least in Arch Linux I can't run sublime with sublime-text but instead with subl so I changed that too in the settings (I don't know if it actually matters) and I needed to change the permissions for the files because user-run sublime could not access my settings files!

How do I name the .bowerrc file?

This MEAN-stack tutorial describes using Bower to install AngularJS in your public folder. One of the steps describes creating a file called ".bowerrc" in your test-app folder. However, Windows won't let you create a file without a name. How do I accomplish this on a Windows system?
on the command line (make sure to cd into your working directory), issue this command:
touch .bowerrc
This will also work for other files common to webdev like .htaccess and .gitignore
Note: If you haven't installed git bash for windows, you may not have support for the touch command. In that case (as mentioned in one of the comments here), the easiest way to accomplish this is via the cli with:
echo "" > .bowerrc
To create a file that starts with a "." in Windows, you just need to add a trailing ".".
So, simply name your file ".bowerrc." instead of ".bowerrc".
See https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows for more information and more detailed solution if this doesn't work for you.
Another way to accomplish this is through Notepad++.
Create the file in Notepad++
Set the encoding to "Encoding in ANSI" (click "Encoding" in the menu bar)
Save the file as .bowerrc (change the "Save as type:" to . which is one list item up from *.txt)
Simply rename the file you created:
C:\project> ren bowerrc .bowerrc

How to use luadoc in ubuntu/linux?

As the title says, how to use luadoc in ubuntu/linux? I generated documentation in windows using batch file but no success in ubuntu. Any ideas?
luadoc
Usage: /usr/bin/luadoc [options|files]
Generate documentation from files. Available options are:
-d path output directory path
-t path template directory path
-h, --help print this help and exit
--noindexpage do not generate global index page
--nofiles do not generate documentation for files
--nomodules do not generate documentation for modules
--doclet doclet_module doclet module to generate output
--taglet taglet_module taglet module to parse input code
-q, --quiet suppress all normal output
-v, --version print version information
First off, I have little experience with Luadoc, but a lot of experience with Ubuntu and Lua, so I'm basing all my points off of that knowledge and a quick install that I've just done of luadoc. Luadoc, as far as I can see, is a Lua library (so can also be used in Lua scripts as well as bash). To make documentation (in bash), you just run
luadoc file.lua
(where file is the name of your file that you want to create documentation for)
The options -d and -t are there to choose where you want to put the file and what template you want to use (which I have no clue about, I'm afraid :P). For example (for -d):
luadoc file.lua -d ~/Docs
As far as I can see, there is little else to explain about the actual options (as your code snippet explains what they do well enough).
Now, looking at the errors you obtained when running (lua5.1: ... could not open "index.html" for writing), I'd suggest a few things. One, if you compiled the source code, then you may have made a mistake somewhere, such as not installing dependencies (which I'd be surprised about, because otherwise you wouldn't have been able to make it at all). If you did, you could try getting it from the repos with
sudo apt-get install luadoc
which will install the dependencies too. This is probably the problem, as my working copy of luadoc runs fine from /usr/bin with the command
./luadoc
which means that your luadoc is odd, or you're doing something funny (which I cannot work out from what you've said). I presume that you have lua5.1 installed (considering the errors), so it's not to do with that.
My advice to you is to try running
luadoc file.lua
in the directory of file.lua with any old lua file (although preferably one with at least a little data in) and see if it generates an index.html in the same folder (don't change the directory with -d, for testing purposes). If that DOESN'T work, then reinstall it from the repos with apt-get. If doing that and trying luadoc file.lua doesn't work, then reply with the errors, as something bigger is going wrong (probably).

How to see vimrc files used during startup

I've moved my vimrc file out of the home directory to pathogenize the setup, but it looks like my vim is still picking up a redundant vimrc file that I made somewhere. Is there some variable in vim that I can echo that'll show what files were used during startup?
:scriptnames lists all sourced script names, in the order they were first sourced.
Look for the $MYVIMRC variable:
:echo $MYVIMRC
After starting vim, you can type
:set runtimepath
See the docs here: http://vimdoc.sourceforge.net/htmldoc/options.html#'runtimepath'
I don't think #skinp's answer is necessarily sufficient. the runtimepath variable is the very definition of all places vim looks
Additionaly, you can launch Vim with
$ vim --startuptime filename
which should write a list of loaded scripts (including vimrc) and their respective processing time to file filename.

Resources