After I've updated Latex, why I still get an error? - latex

I am using MacTex on my Mac and try to us Texmaker as my editor.
However, when I type \usepackage{algorithms} in Texmaker, it always warn me that algorithms.sty is not found. I also tried this in Texshop, the error was the same.
I firstly checked TexLive Utility to make sure algorithms package is installed. It gives an yes. Then I tried to copy algorithms.sty from /usr/local/texlive/2015/texmf-dist/tex/latex/algorithms folder to /usr/local/texlive/2015/texmf-dist/tex/latex/base folder and execute texhash to update. Still not working and get the same error.
Can someone help me with this? Any help is appreciated.

algorithms is actually a bundle that provides two separate *packages":
algorithm
Provides the algorithm float and float-associated accessories.
algorithmic
A environment that provides a layout of algorithm pseudo-code.
So, to use algorithms, you need either or both of
\usepackage{algorithm}
\usepackage{algorithmic}

Related

Confusion on TikZ and PGF LaTeX packages - what they are, how they are stored by MiKTeX, and how they are interpreted by LaTeX compilers

I use VSCode to write LaTeX using the LaTeX-Workshop VSCode extension, MiKTeX, and pdflatex. The LaTeX-Workshop extension comes with the handy feature of being able to hover packages and view their documentation, but I noticed that this feature does not work on the tikz package.
Screenshot with more detail.
I started looking into why this was the case, as the ctan page linked had this long and very detailed manual for TikZ and PGF. It turns out that MiKTeX does not even list a package called TikZ, which is confusing as my .tex files seem to compile fine when including the line \usepackage{tikz}, whereas attempting to use any other 'nonexistent' package would result in a compilation error.
I've gone through half a dozen webpages trying to understand what PGF and TikZ are in more detail, but it is very confusing. The ctan PGF page says "PGF is a macro package for creating graphics... that comes with a user-friendly syntax layer called TikZ", but I'm a little confused about what that means. Why would the package and syntax have different names?
My questions can be summed up as:
What exactly is PGF and TikZ? What's the difference between the two and is there a reason why they have different names?
How does my LaTeX compiler interpret "\usepackage{tikz}" if I don't have a package by that name installed?
What are TikZ libraries and what do lines like "\usetikzlibrary{arrows}" do exactly? Are they basically the same as packages?
If I'm using MiKTeX, where are the TikZ Libraries stored on my machine (Windows 10)? I have been able to find most other packages and their documentation within subfolders of "C:\Users\{USERNAME}\AppData\Local\Programs\MiKTeX 2.9\".
Instructions on how to link the TikZ/PGF manual pdf to MiKTeX so I can easily access the documentation in VSCode would be nice, but that is not really the focus of this post.
For clarification, I am not looking for a tutorial on how to use PGF/TikZ (there are many other good resources for that), nor am I looking for an overly high-level answer like "PGF/TikZ is a LaTeX package for creating graphics" that don't provide any more detail, I know that much already.
Pre-remark:
There are two slightly different usages for the word "package" in the latex world, one is the traditional \usepackage{....} you know from your latex document, the other is the ctan/miktex/texlive package. Most of the time, a ctan/miktex/texlive package simply contains the latex package of the same name, but sometimes it can have a different name and/or contain multiple latex packages at once.
What exactly is PGF and TikZ? What's the difference between the two and is there a reason why they have different names?
pgf provides the low level commands, like strokes etc. and tikz builds on top of this and uses the low level pgf commands to draw more complicate things, like geometrical shapes or rubber ducks (shameless plug)
This division between the low level and high level code is very useful, because it allows the user to load just as much as necessary. Take for example the beamer class. It uses all kinds of low level pgf commands to draw decorations on the slides, so it loads (parts of) the pgf package. It does not need all the fancy stuff from the tikz package, so it does not load it, which safes tons of time, because loading all of tikz is relativity slow.
How does my LaTeX compiler interpret "\usepackage{tikz}" if I don't have a package by that name installed?
You do have it installed, it is contained in the ctan/miktex/texlive pgf package. \usepackage{tikz} basically translates to \input{tikz.sty}. This file in return will load the latex pgf package (and many other things)
What are TikZ libraries and what do lines like "\usetikzlibrary{arrows}" do exactly? Are they basically the same as packages?
yes, they are basically packages for tikz with which you can extend the capabilities of tikz even further.
If I'm using MiKTeX, where are the TikZ Libraries stored on my machine (Windows 10)? I have been able to find most other packages and their documentation within subfolders of "C:\Users\{USERNAME}\AppData\Local\Programs\MiKTeX 2.9\".
You can look this up yourself in your .log file. Search it for tikz.sty and this and the following lines will tell you the location of all the files.
Instructions on how to link the TikZ/PGF manual pdf to MiKTeX so I can easily access the documentation in VSCode would be nice, but that is not really the focus of this post.
If you open a new terminal in vscode (ctrl+shift+`), you can open the user guide by typing texdoc tikz or texdoc pgf (same file, just multiple ways to open it)

org-mode latex preview not working -newbie

I have recently installed org-mode for emacs through its package manager, and for some reason the latex-previewing feature does not work. I've tried both imagemagick and dvipng.
The message that I get when I try [C-c C-x C-l] is: "Symbol's function definition is void: org-infile-export-plist." I'm relatively new to emacs so I'm not sure how to proceed. I've been googling for about 2 hours and I haven't found anyone with a similar problem.
I have the latest version of emacs and org-mode 7.9. I checked about mixed installation issues (as suggested by the org manual) and everything checks out. I'm running Linux mint 17.
Can someone suggest a solution?
ps: I've tried AucTex and that works, but I think it only works on .tex files, not on .org files.
Edit: since I made the post I've found out that several other commands are giving me the same error (with different variables after the colon). Is there something wrong with my installation?
I was facing similar issue while trying to solve a bug in org-mode on spacemac, preview-toggle-latex-fragment which apparently causing the bug when the stack is in this order
spacemac 0.200.13
emacs-plus 25.3_2
org-plus-contrib-20180521
a few of this solution might come in handy, it didn't work for but it definitely gave me a broader view of the situation I'm facing
org-mode-9-unable-to-eval-code-block
org-latex-preview
As I google-fu my way through, I stumbled upon a issue posted on d12frosted/homebrew-emacs, which sort of convince me to give mituharu/emacs-mac a try and it turned out that it worked really well out of the box and solve the problem.
My current working configuration for my (org-mode + latex) would be
spacemacs 0.300.0 ( dev branch )
emacs-mac 26.1
+emacs/org ( spacemac layer )
org-plus-contrib-20180521
latex-math-preview (elpa)
dvipng ( it wasn't on brew, it came with TexLive)
$ tlmgr install dvipng
TeXLive
Once you've solved the problem, you might find this helpful as well.
auto preview latex fragment
This is old but since I had the same issue, maybe it'll help someone else. This happens because the Org export functions haven't been loaded. Try doing export and cancelling it with the sequence C-c C-e q this will cause ox (Org export) to be loaded, and latex preview should now work. If that fixes your issue, add this to your .emacs:
;; Preload org export functions, needed for latex preview.
(require 'ox)

How to print Smalltalk code from Pharo/Squeak?

What is the best way to print - syntax colored and well formatted - code from Pharo/Squeak on paper?
1) Is there a way to print directly from within Pharo/Squeak? (i use it on macosx)
2) Is there a way to export syntax colored, well formatted code from Pharo/Squak?
3) Are there external tools to color and format a filed out piece of code?
For the appendix in my master thesis I used the Pier CMS-to-LaTeX converter in the Pier-Documentation package. However, this plugin only takes class comments and method comments into consideration, it does not print the source code. Pier also provides a package ShoutPier for syntax highlighting of Smalltalk code, so I guess it would require little work to bring the two together. You can find the mentioned extension packages in http://source.lukas-renggli.ch/pieraddons.html.
Pharo browsers seem to use syntax highlighting.
What difficulty are you having reading Smalltalk code using the browsers and senders/implementors ?
Edit: Would something that produces UML give the overview you're looking for? The Dandelion website only shows downloads for old Squeak versions - I don't know if they would work with Pharo.
And perhaps this GSoC project "Generate UML diagrams from Smalltalk code for Pharo" suggests not.
Here's how I did it on my Mac, I think this should work on other platforms too.
Save your categories to a Monticello local folder on your disk -- see the Pharo manual on how to do this: http://book.pharo-project.org/book/PharoTools/Monticello/?_s=hdGOLc_FXsvVY1iR&_k=YYH-Ln8f5mtWZ8z2&_n&148
Browse to this folder, and unzip the .mcz file
You'll see all your code in snapshot/source.st file
You'll need to edit this a bit, to remove the ! characters for e.g., there might be a tool to do this?
-Eric.
There is webdoc project, which allows you navigating code in web browser:
http://ss3.gemstone.com/ss/webdoc.html
(and of course you can print code from your favorite web browser)..
1) Install shout from www.squeaksource.com
2) I don't know. May be you can customize shout.
3) In gnu-smalltalk you have a smalltalk mode for emacs. But I am not pretty sure to understand what you are looking for.

Texments package not working on Ubuntu

I am trying to use the Texments Latex package on Ubuntu to do syntax highlighting.
Texments is a wrapper around Pygments.
I installed Texments and followed the steps to add the style file to the path.
But when I try to compile the .tex file, I get the error.
!Undefined Control Sequence
and then it prints out a bunch of wierd characters and places the ? prompt.
Anybody facing this error? What is the resolution?
If there is any other better way to provide syntax highlighting of source code I would be glad to accept it.
I know there is something called "listings" but frankly, i did not find the colors so good in it.
Thanks,
Perhaps you could give minted a try … it basically does the same as texments but has more features and is a little more robust in the face of errors.
Furthermore, as the maintainer of minted I’m always glad of error reports. ;-)
Texments uses a special control sequence for pdftex to allow shell escapes, needed to call the pygmentize binary. You need to call it with pdflatex, and you need to pass pdflatex the -shell-escape switch. Cf. the texments documentation.

Using GNU Readline; how can I add ncurses in the same program?

The title is a bit more specific than my actual goal:
I have a command-line program which uses GNU Readline, primarily for command history (i.e. retrieving previous commands using up-arrow) and some other niceties. Right now the program's output appears interspersed with the user's input, which sometimes is OK but the output is asynchronous (it comes via a network connection in response to the input commands), and that gets annoying sometimes (e.g. if lines are output when the user is typing new input).
I'd like to add a feature to this program: a separate "window" for the output. I thought about using ncurses for this. But it appears from the ncurses FAQ that the two libraries are not easy to use together.
I might consider using Editline or tecla instead of Readline, but it's not clear to me if either of those will solve my problem. I'd also consider using something other than ncurses, including a library which provides both kinds of functionality (text-mode windows and command history), but I don't know what might be best.
Oh, and support for colored text might get bonus points. I suspect I may be able to do that with Readline, so maybe it's a separate concern, but if a solution to my problem also makes it easy to add a bit of color to the output, so much the better.
I'm using Ubuntu Hardy (Linux 2.6).
I've now put together a simple example program on GitHub: https://github.com/ulfalizer/readline-and-ncurses.
It supports seamless and efficient terminal resizing and multibyte/combining/wide characters. The code has helpful comments.
Screenshot below:
I have done some searching, and it seems like you are out of luck.
For ncurses alternatives there are SLang, Newt and Turbo
Vision. Slang is much more than just screen handling and thus more
complex, but maybe it can be used for your purpose?. Newt uses the screen
handling and is much simpler, but too simple and single-threaded-mode
for your purpose I think.
Turbo vision is the text mode graphics library from Borland, used by
all their tools in the late 80s/early 90s. Borland released the source
code when the market for that kind of thing diminished, and there is
now a port for linux (side note, this project seems to have written
its own turbo vision implementation). That port is not dead (there have
been some cvs updates this year which compiled fine (the older releases
did not)), but none of the TV examples I found were up to date and I
did only got a few of them to compile before giving up on the rest.
This is a bit of a shame, because TV was a lovely environment to use.
TV is btw C++ (and I assume you are using C?).
For an alternative to readline, there is libkinput, which maybe works
together with ncurses (it says it can use ncurses' terminfo. but I am
not sure if that means that it can co-exists together with ncurses usage)?
Maybe one option is to run readline "externally" to your ncurses program
using rlwrap?
This had me banging my head for a few hours, so just to save people Googling some pain:
If you're using ncurses' builtin SIGWINCH handler with KEY_RESIZE, be aware that readline sets the LINES and COLUMNS environment variables by default. These override any dynamic size calculation (usually with ioctl() TIOCGWINSZ) that ncurses would otherwise do, meaning you'll keep getting the initial terminal size even after resizing the terminal.
This can be prevented by setting rl_change_environment to 0 before initializing readline.
Update:
Here's some additional information I gleaned from the readline sources:
readline's SIGWINCH handling code (which is used if rl_catch_sigwinch is 1) does update LINES and COLUMNS, which seems like it should be sufficient for ncurses. However, when using the alternate readline interface (which makes most sense when combining readline with ncurses), the signal handlers (including the one for SIGWINCH) will only be installed for the duration of each rl_callback_read_char() call, meaning any terminal resize between two calls to rl_callback_read_char() will not be seen by readline.
So it turns out that gdb uses both readline and ncurses. If you're interested in doing this, I recommend that you check out their implementation: http://sourceware.org/git/?p=gdb.git;a=blob;f=gdb/tui/tui-io.c
I've achieved what you've described in a program of mine:
http://dpc.ucore.info/lab:xmppconsole
The following is the file handling io:
http://github.com/dpc/xmppconsole/blob/master/src/io.c
I'm not sure which version you tried. As of today(2012.09.14) It is very simple, We just need to hook our custom function to following function pointers.
rl_getch_function
rl_redisplay_function
rl_completion_display_matches_hook
I did something reasonable here.

Resources