I am trying to add a table of contents for my LaTex document. The issue I am having is that this line:
\subsubsection{The expectation of \(X^2\)}
Causes an error in the file that contains the table of contents
\contentsline {subsubsection}{\numberline {1.2.3}
The expectation of \relax $X^2\relax \GenericError { }{
LaTeX Error: Bad math environment delimiter}{
See the LaTeX manual or LaTeX Companion for explanation.}
{Your command was ignored.\MessageBreak Type I <command> <return>
to replace it with another command,\MessageBreak or <return> to
continue without it.}}{5}
Which causes the document not to be generated.
Does anyone have a solution to having maths in sections while still having the table of contents
You should use the Amsmath inline math delimiter $ instead of \( and \). Thus:
\subsubsection{The expectation of $X^2$}
Note: be sure to remove the currently generated .toc file first, otherwise the error will not go away.
If you wish to continue using \(...\) as your math delimiters, you can load the (officially supported) fixltx2e package. This is where fixes to LaTeX go that cannot be integrated into the main sources because of the possibility of backwards compatibility problems.
(In short, your problem is that \( and \) by default aren't "robust" and hence can't be used in places like section headings and captions; the fixltx2e package fixes this.)
Could you try again with putting the $ signs around the expression? What error do you get?
Related
I want to italicize my prompt (specifically the right prompt/RPROMPT) for zsh using oh-my-zsh, in iTerm2, and so far have had problems doing so. I have checked that the terminal can output and view italicized fonts with echo -e "\e[3mitalic\e[0m".
Things I have tried so far :
RPROMPT = '\e[3m Hello \e[0m' : the output is a literal quote \e[3m Hello \e[0m
from here, I tried
HELLO = Hello
RPROMPT = '\e[3m $Hello \e[0m'`
and the output still has the \e[3m and \e[0m parts
from an example, I tried using \x1b[3m rather than \e[3m : still outputs \x1b[3m and \x1b[0m
I found this page but I don't understand what I'm looking at/what I'm supposed to do.
I would like to get the italic format working, so any help is greatly appreciated.
You can use RPROMPT=$'string with special escaping' (See bash manual)
It may have a few issues such as the left prompt getting edited.
After further testing based on GrapeApple's answer, I found a solution that does not mess with the left prompt. Per zsh documentation, you need to use a string quote %{ ... %} to wrap around the escape sequence formatting, e.g. :
RPROMPT=$'%{\x1b[34;1;3m%} hello %{\x1b[0m%}'
For better compatibility (in case you run your zsh one day with a different kind of TERM), I would not hard-code the escape sequences, but use something like
RPROMPT="$(tput sitm) Hello $(tput sgr0)"
See man terminfo for the meaning of sitm and sgr0.
I want to make a submission, so I downloaded this example:
https://www.isa-afp.org/entries/Example-Submission.html
How to compile it? This is my main aim. Maybe a description may contain such command?
I've tried to find the answer here:
http://isabelle.in.tum.de/doc/system.pdf
But it contains strange lines, rectangles and circle instead of examples. I don't understand them.
So how one can compile this particular session in Isabelle?
The boxes describe the syntax of the ROOT file.
You have to read Section 2.3 of the document to know how to compile the document, but in short:
isabelle build -o browser_info -o document=pdf -d /path/to/Example-Submission Example-Submission
In zsh (with oh-my-zsh, is that matters) when I enter empty commands (e.g. just press enter) I see empty lines added to my ~/.zsh_history:
: 1508496422:0;ls
: 1508496422:0;vim
: 1508496482:0;
: 1508496482:0;
: 1508496482:0;
: 1508496482:0;
: 1508496490:0;
: 1508496490:0;
: 1508496490:0;
: 1508496490:0;
: 1508496494:0;ls
I'm wondering if it's possible to avoid adding these lines. I checked http://zsh.sourceforge.net/Doc/Release/Options.html but no luck. The reason why I'm trying to avoid adding empty lines is I'm using fzf and fzf lists these empty commands when I search in last commands in a directory.
If this is not possible in zsh side I'll try to search for a solution in fzf side.
There are a few Zsh settings to control what goes into your history
(though I'm surprised emtpies end up there; I can't reproduce that
despite also using fzf and hitting blank RETs a lot).
The man page for zshoptions(1) describes:
HIST_IGNORE_[ALL_]DUPS — This should at least reduce your
consecutive multiple empties down to one.
HIST_IGNORE_SPACE — Your empties might be treated as whitespace
and thus be eliminated. I like this feature anyway for intentionall
discarding commands by starting them with a space.
There is also the HISTORY_IGNORE option (not to be confused with
Bash's HISTIGNORE) — described in zshparam(1) with an example —
which lets you remove a set of patterns. An empty pattern may fix
your case. It also has a zshaddhistory hook that you could use to
more finely control exactly what goes into history.
In sketch documentation it's stated that dot and braces notations can be mixed with each other. It's even an example available:
[[context.document currentPage] deselectAllLayers];
Unfortunately, this code doesn't work in sketch and produce error if executed by "run custom script" command:
SyntaxError: Unexpected identifier 'currentPage'. Expected either a closing ']' or a ',' following an array element..
Plugin “untitled script”, line 2.
» [context.document currentPage]; «Error in command untitled script Script at path (null) does not contain a handler function named: onRun
Script executed in 0.023666s
This can be avoided by adding additional ( and ):
[[(context.document) currentPage] deselectAllLayers];
Why this happens? Is it any documentation available how exactly braces and dot notation can be mixed? Is it some error or expected behaviour?
It seems to me it's an error, but in Sketch documentation. Besides this case you showed, I couldn't find any other example where dot and braces notations are used together in the same statement, without parentheses.
The documentation page about Selections, for instance, tells that you'd use the following code to unselect everything:
var doc = context.document
[[doc currentPage] deselectAllLayers]
Follow this link and look under Clearing the selection header: http://bohemiancoding.com/sketch/support/developer/02-common-tasks/01.html
Even their example plugins don't mix both notations, as you can see here: https://github.com/BohemianCoding/ExampleSketchPlugins/blob/master/Hello%20World/Hello%20World.sketchplugin/Contents/Sketch/script.cocoascript.
In that example, context.document is also assigned to a new variable before being used within braces.
I have to hand in a software project that requires either a paper or .pdf copy of all the code included.
One solution I have considered is grouping classes by context and doing a cat *.extension > out.txt to provide all the code, then by catting the final text files I should have a single text file that has classes grouped by context. This is not an ideal solution; there will be no page breaks.
Another idea I had was a shell script to inject latex page breaks in between files to be joined, this would be more acceptable. Although I'm not too adept at scripting or latex.
Are there any tools that will do this for me?
Take a look at enscript (or nenscript), which will convert to Postscript, render in columns, add headers/footers and perform syntax highlighting. If you want to print code in a presentable fashion, this works very nicely.
e.g. here's my setting (within a zsh function)
# -2 = 2 columns
# -G = fancy header
# -E = syntax filter
# -r = rotated (landscape)
# syntax is picked up from .enscriptrc / .enscript dir
enscript -2GrE $*
For a quick solution, see a2ps, followed by ps2pdf. For a nicer, more complex solution I would go for a simple script that puts each file in a LaTeX listings environment and combines the result.