The following code works fine  \begin{theorem}[Euler] Blah \end{theorem}   But whenever I try to use square brackets in the description I get an error.  \begin{theorem}[The set $[0, 1]$ is compact] Blah \end{theorem}   Can anybody tell me how to avoid the error, please?
I accidentally discovered () that a closing square bracket within an optional argument delimited by [ ] can cause problems.  Here is example code illustrating the issue:  \documentclass{article}   \begin{document}  \tableofcontents  \section[Square brackets ([ and ])]{Square brackets: [ and ]} % bad: the TOC now has "Square brackets ([ and", and the actual title is a mere ")".  Some text.  \section[{Square brackets ([ and ])}]{Square brackets: [ and ]} % good (works as originally intended)  Some text.  \end{document}   The text to be used as the optional (as well as the non-optional) argument contains a ], and this character is not supposed to function as the optional argument terminator but as a matching square bracket/parenthesis. Perhaps this is as it should be, but the question is how to best circumvent any potential problems. Enclosing this in a group works, but I don't know whether doing this has other side effects (perhaps not here in the case of \section but hopefully someone else has a better example of where grouping could lead to a problem). There is no (obvious) way other than writing [{ }] because [ and ] are not normally escaped. That [ and ] are normal characters and bear syntactic function (as optional argument delimiters) creates this potentially problematic situation.  Is simply enclosing the entire optional argument in a group ({ }) a good solution? Are there other/better ways?
Duplicate:    I want an pseudo random number generator that can generate numbers with no repeats in a random order. For example: random(10) might return 5, 9, 1, 4, 2, 8, 3, 7, 6, 10 Is there a better way to do it other than making the range of numbers and shuffling them about, or checking the generated list for repeats?  Edit: Also I want it to be efficient in generating big numbers without the entire range.  Edit: I see everyone suggesting shuffle algorithms. But if I want to generate large random number (1024 byte+) then that method would take alot more memory than if I just used a regular RNG and inserted into a Set until it was a specified length, right? Is there no better mathematical algorithm for this. Why does my shell script choke on whitespace or other special characters? What is the best way to increase my reputation and privileges? How can I format to show text inside ""? I've posted a lot to StackOverflow, and I've noticed something kind of irritating with the formatting in writing questions and comments. If I need to put something inside a &lt; and a >, without spaces in the middle (like right there), it will think it's code and not show up, like this   (obviously it won't come up what I wrote there, or else this wouldn't be an issue, but if you open up the question to edit you can see what's written there.)  If I want it to show up, right now I have to add an extra set of brackets inside of the originals with a junk variable, like right &lt;here> (again, open in edit window to see).  This is really annoying when trying to show variables like lists that require those brackets, and I feel like the junk variables could confuse people looking at the edits. Is there a way to get around this formatting? Thanks! Can wizards create their own spells? In the Harry Potter series, are wizards capable of creating their own spells, or are they limited to the spells that they're taught/learn?  I seem to remember something about Snape creating sectumsempra, but I'm not sure if that really is the case. Where can I obtain an English dictionary with structured data? I am trying to prove the following identities:  a. $$\sum_{k=0}^n(-1)^k{n\choose k}^2 = \bigg\{^{0 \ \text{if k is odd}}_{(-1)^m{2m\choose m} \ \text{if n = 2m}}$$ b. $$\sum^k_{i=0} {n+i \choose i}={n+k+1\choose k}$$  For part $b$ I know I can use induction. It is clearly true when $k=0$ and then assuming for $k-1$ we get $$\sum^k_{i=0}{n+i\choose i}={n+k\choose k-1}+{n+k \choose k}={n+k+1\choose k} \ ...$$ Basically, I want to have a single operator which can do multiple things, based on some attributes values.  class MyPanel(bpy.types.Panel):     # (...)     layout = self.layout     row = layout.row()     row.operator("my.button", text="Button text")  class MY_BUTTON_OT_Button(bpy.types.Operator):     bl_idname = "my.button"     bl_description = "Button description"     bl_label = "Button"     foo = bpy.props.IntProperty()     bar = bpy.props.BoolProperty()      if bar:         # Do something with foo     else:         # Do something else :P   I know how to set one attribute, like so:      row.operator("my.button", text="Button text").foo=5   But what about multiple arguments? I tried several things that didn't worked, like (e.g.):   With setattr(): row.operator("my.button", text="Button text").setattr(foo=5,bar=True)   With a custom method setVal() in the operator class: row.operator("my.button", text="Button text").setVal(foo=5,bar=True)   Maybe I must use a single EnumProperty? I hope to avoid this, so my question is: Is it possible to pass multiple custom arguments to set attributes in an operator class? And if yes, how ?  Thanks for your help. How does vendor restocking work in Fallout 4? When a spaceship is experiencing a constant acceleration of $10m/s^2$, the astronauts will be moving at nearly the speed of light after about a year in the earth's reference frame. This means the spaceship's energy will start to diverge as a function of the speed $v$ so there will be a huge amount of energy necessary to increase the speed of the ship any further. This way, the speed of light can never be crossed.  All of this is clear to me, but all of this is also formulated in earth's reference frame. But from the astronaut's reference frame: the spaceship is simply accelerating at $10m/s^2$ and so the force on the spaceship is constant. Then why would we need huge amounts of energy to accelerate the spaceship?  For example, I read somewhere that the amount of energy that would be needed to accelerate a large spaceship to half the speed of light is more than 2000 times the current world annual energy consumption. How does this make sense in the astronaut's (non-inertial) frame? Compile TeX (directly) into SVG using the command line Is there a way to directly compile TeX code into the SVG image format (rather than going the detour over TeX => PDF => SVG)?  I found this question:   But I don't want to do it online - it should be a command-line call. Freeman and Tukey interval If $Y$ is Poisson$(\lambda)$ distributed, how do we obtain this confidence interval for $\lambda$:  $$ \left (\frac{(\sqrt Y+\sqrt{Y + 1}-z_{(α⁄2)} )^2 - 1}{4},\  \frac{(\sqrt Y+\sqrt{Y  +1}+z_{(α⁄2)} )^2 - 1}{4} \right ) $$ Do I have to claim and re-check in my baggage in international transit when traveling with the same airline? I'll be traveling to Memphis, Tennessee form New Delhi, India via Qatar Airways.  The itinerary would be: New Delhi &lt;--> Doha || Doha &lt;--> Chicago || Chicago &lt;--> Memphis  Would I be required to claim and re-check my baggage at Chicago even though all the flights were booked with Qatar Airways or can I check it in all the way from New Delhi to Memphis without re-checking in the baggage again? How can I force a long string without any blank to be wrapped? I have a long string (a DNA sequence). It does not contain any whitespace character.  For example:  ACTGATCGAGCTGAAGCGCAGTGCGATGCTTCGATGATGCTGACGATGCTACGATGCGAGCATCTACGATCAGTCGATGTAGCTAGTAGCATGTAGTGA   What would be the CSS selector to force this text to be wrapped in a html:textarea or in a xul:textbox? Are there integral solutions to the equation $x^2+y^2-z^2=1$? It is well known that $\sqrt{2}$ is irrational, and by modifying the proof (replacing 'even' with 'divisible by $3$'), one can prove that $\sqrt{3}$ is irrational, as well.  On the other hand, clearly $\sqrt{n^2} = n$ for any positive integer $n$.  It seems that any positive integer has a square root that is either an integer or irrational number.        How do we prove that if $a \in  \mathbb N$, then $\sqrt a$ is an integer or an irrational number?      I also notice that I can modify the proof that $\sqrt{2}$ is irrational to prove that $\sqrt[3]{2}, \sqrt[4]{2}, \cdots$ are all irrational.  This suggests we can extend the previous result to other radicals.        Can we extend 1? That is, can we show that for any $a, b \in \mathbb{N}$, $a^{1/b}$ is either an integer or irrational? How do I calculate a time delta in my Google Spreadsheets? Right-Click menu awareness on Web Application The web application I am building has a custom right-click menu. I'm concerned that the user might not find this menu as normally right-clicking will only display the default browser's menu. Is there a standard way to make the user aware of custom right-click menus? Is there another way to show this information? Xubuntu live usb persistence - how to? I'm using Xubuntu 13.04 from live usb.  I know that in order to be able to keep files/settings/etc after restart, USB live disk should be created with some storage reserved. However since I got this USB from a friend who created installation, I don't know if he reserved any space, and so my questions are:   How can I find out amount of space reserved (if any)? If no space is reserved, can I manually chose USB/HDD location to store my settings in order to be able to boot into them the next time I log on?   I'm currently running a very long session and it would help me if I could somehow be able to store my settings (firefox, apt-gets, xrandr screen conf. ... ) to not have to do it again after I reboot.  Thanks,  IR Tag synonym suggestion textbox is overlapped by "Suggest" button