Matplotlib failing while text.usetex==True - python-2.7

I want to use Latex to create greek symbols in plot labels. However any attempt to set e.g.
rcParams['text.usetex'] = True
or any other version of this I could find, results in a screen full of errors even for plots in which labels aren't even used. If I set it back to False everything is fine. I know I should "post my attempt" but I emphasize that every example on this forum and any other webpage I can find that claims to achieve the objective fails.
The final error on the pages of errors is that type1cm.sty is not found. Using tex Live utility I see I have it installed.
Would appreciate help for novices here as I am not exactly computer savvy.
In response to below - I am using a Mac OSX version 10.9.5. The usual program I use for my Tex stuff is TexShop version 3.18.
Since it would appear that the iPython notebook is having problems with finding the type1cm.sty file, I would assume there is some method to tell it how to find it.

Related

sympy pretty printing causes console to freeze

I had a fresh install of miniconda, sympy, spyder, qtconsole, matplotlib, and tried out sympy under spyder. However, the output of anything from the console freezes the kernel, making the session irresponsive:
Notice the red square at the upper right corner, indicating evaluating never stops. If I turn off pretty_print, the output can appear:
I have latex installed and work fine. I tried playing with init_printing but nothing works unless I turn off pretty_print. I do need the output to be readable. I uninstalled and reinstalled but no luck. How do I fix the output problem for pretty_print? The system is windows 10, and everything is default latest version as of 7/10/2021.
I ran into the same problem, and I got around it by explicitly calling init_printing(use_latex='mathjax'). As the doc below indicates, by default use_latex=None and sympy should be able to find a latex rendering option automatically, but it seems to fail to do so and somehow gets stuck.
use_latex : string, boolean, or None, default=None
If True, use default LaTeX rendering in GUI interfaces (png and
mathjax);
if False, do not use LaTeX rendering;
if None, make a guess based on the environment;
if 'png', enable latex rendering with an external latex compiler,
falling back to matplotlib if external compilation fails;
if 'matplotlib', enable LaTeX rendering with matplotlib;
if 'mathjax', enable LaTeX text generation, for example MathJax
rendering in IPython notebook or text rendering in LaTeX documents;
if 'svg', enable LaTeX rendering with an external latex compiler,
no fallback

Identical rmd files create different latex files when run on two computers

When my colleague and I run the same Rmd file on our respective computers they produce different .tex files. This is a problem, because the tex-file my computer produces doesn't compile. Apparently there is some invisible local setting that is different between our computers but what could it be? I updated all the Rpackages I use but to no avail.
The Rmd file starts with
output:
bookdown::pdf_document2:
keep_tex: yes
toc: false
And both of us compile it by simply hitting the knit-button in Rstudio.
Noticeable differences in the tex-files are:
extra linebreaks in different places
a line that is commented out in the rmd-file (<!-- blabla -->) appears in my tex-file, not in his, but some other out-commented lines appear in neither (as they should)
at the end of lines in tables there is a \strut inserted in my tex-file but not in his
Section heads read \hypertaget{blabla} in his file but not mine
For none of these difference I can find any place in the Rmd-file where any choice w.r.t to this is made - apparently some local settings file I am not aware of is used in the process??
Please let me know if you need more information.
EDIT: we found a partial answer and full solution, but I am still interested in what the underlying mechanism is. It turned out that I was using an older version of Rstudio. (It took me long to find that out because the check for updates tool in Rstudio kept telling me that I was using the newest version, but that is a separate issue.) Using the same version of Rstudio we get the same result.
The translation from Rmd to tex has multiple steps:
All the code chunks are extracted and executed via knitr, resulting in a md file.
The md file is translated to tex via pandoc.
For most people pandoc comes bundled with RStudio. So when you updated that, you got a more recent pandoc version. You can test for the used pandoc version with rmarkdown::pandoc_version().

Why isn't my terminal running my updated C++ code?

I am a new programmer and I am trying to use the terminal on my Mac to compile and run the C++ code I write using the Sublime text editor.
I am able to get my code to run using the terminal, however, whenever I make changes to my code on sublime and then re-compile it on my terminal, my terminal doesn't recognize my changes and keeps on running my original code.
Does anyone know what might be happening?
Thank you so much!
I can think of two possibilities that spring immediately to mind. If you're changing your code in the editor, and that's not being reflected in the compilation, then it's likely to be one of the following. Either:
you're not saving the file in the location you think you are; or
you're not saving the file at all.
The easiest way to tell if one of these is the case is to introduce an error into your code(a), like:
int my hovercraft = full of eels;
and make sure the compiler complains about it.
If you're not saving it at all, do so. If you're saving it in the wrong place, you can usually find out where just by doing a Save As and seeing where the default location is.
If you're annoyed that you have to save, and that computers should just "work"(b), Sublime Text has an auto-save feature that may come in handy, courtesy of one Lucy Bain. Instructions (paraphrased) are duplicated here in case that site ever disappears:
Open Sublime
Find Settings and edit the user window (under Sublime Text 2 > Preferences for Mac, just Preferences for Windows).
Add the line "save_on_focus_lost": true.
Save and close the file.
At that point, whenever you click away from a particular file, it should save it.
(a) Some developers seem to have little trouble doing this without even trying :-)
(b) A not unreasonable expectation for a Mac user :-)

Yeoman causes obscure double-print output when run as External Tool from WebStorm

I am trying to wire up various yeoman generators as External Tools in JetBrains WebStorm (as well as JetBrains Rider) and am experiencing a very peculiar problem with the output.
On generators that take any kind of input, there is all sorts of cattywompus output, specifically duplicated output that is obtusely fragmented.
Thinking this might be a problem with the terminal encoding, I've turned the encoding to UTF-8 in the *.vmoptions file as told by support by adding -Dfile.encoding=UTF-8 to the file and rebooting.
But it doesn't seem to matter what I do, or how I configure it - when I configure a yeoman generator as an external tool, I get obscure output. I've captured the phenomenon in a screen cast here;
VIDEO OF THE PROBLEM OCCURRING
I have also just included a screenshot, for those who would rather not watch the video.
These are the settings I'm using for the external tools, in their respective order;
For good measure, here is a repository of the exact generator I am using in the video and screenshots; The easiest way to make this available is to run
npm install
npm link
The problem is caused by ANSI sequences processing in external tools console. Yo generator uses inquirer.js module that, in turn, uses some special ANSI escape sequences to format the output, namely
CSI 8D Cursor Back
CSI 8C Cursor Forward
CSI 2K clear entire line
these sequences are not currently supported; please follow IDEA-149959 and linked tickets for updates

C++ Keywords not Colored in Emacs

I have been using emacs for a while for mainly python programming, and have started C++ coding with it. When I open a c++ file, it opens without problems with c++-mode. The background and foreground colors are normal for the theme I have with color-theme, but keywords and strings are not colored differently. Below is the code in my .emacs to initialize color-theme.
(add-to-list 'load-path "D:\\emacs\\color-theme-6.6.0")
(require 'color-theme)
(color-theme-initialize)
(setq color-theme-is-global t)
(color-theme-hober)
I have not put in any code for c++. Any ideas?
Edit: I tried turning off color-theme to see if at least then there would be some coloring, and there was not, even after ensuring font-lock-mode was on. Also, this is GNU Emacs 23.1.1
Place the cursor over a keyword and do M-x describe-face. The face should be identified as font-lock-keyword-face and the description of the face given. At that point it should be easier to determine whether the keyword has the wrong face, or the face just has a default appearance. You could also double-check that font-lock-mode is on with describe-mode.
I finally got syntax highlighting by removing a folder called site-lisp from the folder d:/emacs. My Emacs installation is in d:/emacs/emacs-23.1, and somehow it was reading from these files. So, removing this folder forced Emacs to use the correct ones, I think.
(font-lock-mode) should help (with non negative argument to make sure it's turned on)
Generally this should work straight out of the box on a standard install - to verify start emacs with the "-q" option to avoid loading stuff from your init file. I have verified this with a quick install (on XP Pro) of the official 23.2 binaries. Here's the output: (apparently can't post images due to low reputation - the link is img444.imageshack.us/img444/2680/46117077.png).
If this displays code as you expect, then there's an issue with your init file - I suggest using the standard approach of commenting everything out and selectively adding things back in, until you come across the offending line(s).