I use the package listings to add code snippet in my document. my problem is for the character ~. It's placed at the top of the line, like if it was above a letter, while I want it at the middle of the line.  Here is an example:  \documentclass{report}  \usepackage{xcolor}  %%% % For source code %%% \definecolor{mgreen}{rgb}{0.0, 0.4, 0.0} \definecolor{mauve}{rgb}{0.58,0,0.82} \usepackage{listings} \lstset{frame=tblr,   language=c++,   basicstyle=\scriptsize,   aboveskip=3mm,   belowskip=3mm,   captionpos=b,   showstringspaces=false,   % Numbering   numbers=left,   numberstyle=\tiny\color{gray},   keywordstyle=\color{blue},   commentstyle=\color{mgreen},   stringstyle=\color{mauve},   breaklines=true,   breakatwhitespace=true, }  \begin{document}    \begin{lstlisting} class Foo { public:    // Constructor   Foo();    // Destructor   ~Foo(); };   \end{lstlisting}  \end{document}
How do I insert a nice tilde that is centered in the middle in a lstlisting? I found another thread about  but I can't apply it because the method described there only works outside of lstlisting as lstlisting displays all the text literally. Any ideas?  Here is how the tilde looks in my document at the moment - it's at the very top of the font and I would like it to be in the middle (like ~ this).    Here is the LaTeX for this fragment:  \section{Remove duplicate, consecutive lines (emulate "uniq")}  \begin{lstlisting} awk 'a !~ $0; { a = $0 }' \end{lstlisting}  Variables in Awk don't need to be initialized or declared before they are being used.
Why does cold metal seem colder than cold air? (I apologize for this elementary question. I don't know much about physics.)  Let's say that I put a metal pot in the refrigerator for several hours.  At this point, I guess, the pot and the air (in the refrigerator) have the same temperature.  Now, I touch this pot. It feels very cold. But when I "touch" the air (that is inside the fridge) it doesn't "feel" as cold. I don't feel the same "ouch!" that I feel when I touch the pot.  Why is that? Why does the metal seem colder than air although they both have the same temperature?  (I know that gas has less particles in it in one unit of volume compared to solids and liquids, but since "temperature" means "the average kinetic energy", these fewer air particles are supposed to hit my hand in a velocity that's going to compensate for their lower number, aren't they?)  A related question, for clarification:  If I use a thermometer to measure the temperature of the pot &amp; air (let's assume it's a thermometer that has a probe that can touch objects), will it show the same reading for both? If so, what makes the thermometer different than my hand? I mean, my hand is sort of a thermometer, so why would it fail whereas a non-human thermometer would work? If a person was sitting on a craft that has accelerated to near light speed speed from Earth (e.g. 99.999% of light speed) would there be any impact on his or her human biology due to relativistic effects on mass, time and distance?    For example, would the heart still be able to pump blood effectively if the relativistic mass of the blood has increased?    Or would accelerating the blood a bit further towards light speed requires more energy than when stationary on earth? I have a scrbook document with an openright option, i.e. every once in a while a blank left page appears in the document. Not that I really want to do this, but how could I include the infamous "This page has been intentionally left blank" in those blank pages cleanly, i.e. without too many hacks?  Bonus points for including a different famous quote on each blank page instead of the dull default ;) Explain proof by contradiction. CSS selector for first element with class guess the color of the next card There are 26 red cards and 26 black cards on the table which are randomly shuffled and are facing down onto the table. The host turns up the cards one at a time. You can stop the game any time (even at the beginning of the game). Once you stops the game, the next card is turned up: if it is red, you get $1; otherwise you pay the host one dollar. What is the payoff of this game? vs. . Which to use? Choose information when copying profile How to compute the size of the allocated memory for a general type I'm studying special relativity and saw the 2 postulates of Einstein. The most remarkable one for me is the universal speed of light. Einstein postulated that the speed of light in vacuum is the same for all inertial observers, regardless of the motion of the source. But what if we are accelerating and we are changing from one inertial frame to another, how will we observe the speed of light? Is it still the same? I suggest it's not? Because I alread saw a small introduction to general relativity where the light will bend in a gravitational field and therefore also when you accelerate. So does the speed of light change because it bends? What is the difference between the memory usage report in System Monitor and the one by free? I am using System Monitor 2.28.0.  When I look in the Resources tab, I see a nice graph with for memory and swap.  Memory is about 60% 2.3 GiB of 3.8.  When I type the command free, I got :               total       used       free     shared    buffers     cached Mem:       3994908    3962396      32512          0     100852    1477032 -/+ buffers/cache:    2384512    1610396 Swap:      8000328      28468    7971860   cat /proc/meminfo | grep MemFree give  MemFree:           34536 kB   The situation has remained the save for several minute.  I started a lot of process with a script and the script is waiting for the free memory to get lower.  According to what I am seeing in the Process tab (or with top), the number in System Monitor seem a lot closed to the total of the memory of the process that the one reported by free.   Thanks Rejection of text containing SQL statements OK, I've been having weird problems for the last 1/2 hour trying to  on StackOverflow, and I keep getting this result (on Firefox 3.6)     The connection was reset      The connection to the server was reset while the page was loading.         The site could be temporarily unavailable or too busy. Try again in a few        moments.   If you are unable to load any pages, check your computer's network        connection.   If your computer or network is protected by a firewall or proxy, make sure        that Firefox is permitted to access the Web.      The problem seems to occur when I try to post some code with 'd--- table' in it, where 'd---' is replaced by the word drop.  I cannot post the following 3 lines, in either SO or this site, if they include the well-known SQL statements DROP.  stat.executeUpdate('d--- table if exists people;'); stat.executeUpdate('create table people (name, occupation);'); prep = conn.prepareStatement(...     'insert into people values (?, ?);');   test again:  'dro* table' 'drop ball' drop the table drop fable drop    t*ble droptable   drop a table  The evil words for me are "drop" and "table"... how come you guys can post? :(  edit: Could someone please suggest another online site that is not stackoverflow that is a quick way to try out a POST request of a text field?  UPDATE: Never mind. I don't know what the answer is, but the same problem occurs on Google's website. So it's not stackoverflow. Now to go to my IT Dept... What is the meaning of the term "linear" How can I explain how to play D&D to new players without them falling asleep from boredom? Some of my friends just started playing Dungeons &amp; Dragons [5e] for the first time and don't know anything about how to play. I have tried explaining to them the things that are completely necessary and teach them the rest while playing but I could not get them to understand. None of them have a players handbook and they can't afford one and they really want to play. I really want a simple way to explain the basics and since I have a habit of explaining things in ways that are much too complicated. I have already told them the basic rules so all I need to know is a simple way to explain how to play. How to identify a downvoting stalker Possible Duplicate:          Yeah I got a deranged stalker that keeps downvoting me.  Anyone know how going about identifying such individuals?  (I just got 4 all at the same time just after making a new post).      that was the question I originally asked. Please tell me, what is so wrong with it ? In the sentence: "I didn't know she had a son,"   Can I say "I didn't know she has a son" instead, because he is a teenager now?  Or are both correct? I see that there a number of questions (, , , , ) on best practices, none of them answer the issue I am going to talk about.  We all need to prepare large documents (or slides) from time-to-time. And once you have reached a certain number of pages, you find that compiling the whole document takes a substantial time, which you need to do to check that the part you have written is error free, specially if it contains a number of images.   To circumvent the situation, I have used the following practices over years to keep compile time at minimum.   Divide the document in to many chapters: The chapters are put in separate files. Only the one I am working one is uncommented.  \documentclass{book}  \begin{document}  %\input {chapterone.tex} \input {chaptertwo.tex} %\input {chapterthree.tex} %\input {chapterfour.tex}  \end{document}    The above technique can also be used for \include.   Keep a preamble replica of the main file in a temporary file (build file): I use this technique when I am preparing a presentation with many slides, say a hundred. Prepare a main file, copy it to another build file. Delete everything between  \begin{document} and \end{document} in the build file. Prepare a slide (or a group of slides) in the build file. Cut and paste the contents between \begin{document} and \end{document} in the build file to relevant location in the main file only when satisfied with the output (image locations, overfull boxes etc.)     We can hear your inputs about the best practices you practice when a you are preparing a document or presentation from scratch.    Now, I have failed to find a good answer in the case when you have finished the whole document or presentation and now you need tweaking the small things, may be edit a text here, add an image there. What will be your best practice?  Perhaps, again keeping only one chapter uncommented will be usable here. But what about large presentations? May be adding a \end{document} just after the point-of-change will be beneficial, but only if you can put that before midpoint of the file.  Commenting a part of the file will also work, but that is error-prone, at least for me. How would I go about finding $\prod_{n=1}^\infty (1+\frac{1}{n^2})$ ? Setting $a_k = \prod_{n=1}^k (1+\frac{1}{n^2})$, the first few partial products are $a_1 = 2$, $a_1 = 2.5$, $a_3 \approx 2.78$, $a_4 \approx 2.591$, $a_{20} \approx 3.50$, and they eventually appear to converge at around $3.639$. (These values were found with a quick python program. So much for my initial conjecture that the product converged to $e$.)   I tried writing $1+\frac{1}{n^2}$ as $\frac{n^2 + 1}{n^2}$, but it wasn't immediately obvious how to prove convergence / find the limit because the product doesn't really factor or telescope. Is there a way to calculate the limit? Proving “The sum of $n$ consecutive cubes is equal to the square of the sum of the first $n$ numbers.” This   states:      Example $\boldsymbol 3$. The sum of consecutive cubes. Prove this remarkable fact of arithmetic: $$1^3 +2^3 +3^3 +\ldots +n^3 =(1 +2 +3 +\ldots +n)^2.$$   “The sum of $n$ consecutive cubes is equal to the square of the sum of the first $n$ numbers.”      In other words, according to Example $1$: $$1^3 +2^3 +3^3 +\ldots +n^3 = \frac{n^2 (n+1)^2}{4}.$$   Should: $$1^3 +2^3 +3^3 +\ldots +n^3 = \frac{n^2 (n+1)^2}{4}$$ not be: $$1^3 +2^3 +3^3 +\ldots +n^3 = \frac{n^3 +(n + 1)^3}{2^3}$$ as everything in the left-hand side is cubed? I've been through the Windows 10 upgrade, and am experiencing a recurring "INTERNAL_POWER_ERROR", which is stopping me from logging in.  I'd like to be able to try to boot to safe mode, but it appears that pressing F8 during boot is no longer enough, so how can I boot in safe mode (or any of the other recovery options) on a Windows 10 PC that doesn't let me log on?