I make use of a package (gnuplottex) that writes contents of an environment to a file, using the \verbatim@start/processline/end commands (by \immediate\write\FileHandle{\the\verbatim@line}). Now I want to modify the package to insert a couple of user-defined lines at the start of every file.  I defined a token list to store the lines and two commands to set these header lines:  \newtoks\headerlines \def\setheaderlines#1{\headerlines{#1}} \def\addtoheaderlines#1{\headerlines\expandafter{\the\headerlines#1}}   The tokens I then write to the file before the \verbatim@start, with \immediate\write\FileHandle{\the\headerlines}. This works fine for a single line, but I need to write several lines to the file, so preserve newlines in the token and write them to the files. Right now, this does not happen: everything gets put on a single line. How do I preserve newlines in the token list and write as separate lines to the file?  In other words:  \setheaderlines{header line 1 header line 2}   gets written to the file as   header line 1 header line 2`   instead of  header line 1 header line 2
Within a custom command, I'm doing the following to write to a file:  \newcommand\mycommand[1]{   \newwrite\file   \immediate\openout\file=foobar.tex   \immediate\write\file{     foo     bar     #1     blarg   }   \immediate\closeout\file }   Of course when I invoke it as \mycommand{baz}, I get the following contents in foobar.tex:  foo bar baz blarg   with all new lines turned into spaces by LaTeX. My question is, is there a way to output these lines into the file "as expected", i.e. with real new lines at the end of each line instead of a space? I'm thinking some \catcode wizardry should do the trick, but I'm not sure which character I need to redefine and to what category code.  Update  The solution in  works perfectly. The only problem is when #1 contains embedded newlines. I can of course send it to mycommand with its own slew of ^^J, I was wondering if there is a way to avoid this.
How do I fix my locale issue? 1.In classical mechanics, using Newton's laws, the ellipticity of orbits is derived. It is also said that the center of mass is at one of the foci.   2.Each body will orbit the center of the mass of the system.  My question is : Are the assumptions in 1 and 2 correct?   Follow up question : Assuming the distance from the centre of the mass to each body remains the same, do we have two bodies orbiting the centre of the mass of the system in an elliptical or circular orbit?   Finally : With elliptical orbits, if the heavier mass is supposed to be in one of the foci, if there is any significance to second focus, what is it? Is it a Lagrange point by any chance or does it have some other mathematical property? How to calculate the signal-to-noise ratio (SNR) in an image? I am working with an image X, I apply the "adaptive median filter" in it and I get the image Y. I'd like to measure the SNR in both in order to evaluate the quantity of noise deleted.   I know the formula to calculate the SNR is:   SNR = Psignal / Pnoise  but I don't know how to get these values from both images I have. I was thinking in substract the image X from Y and get the noise value. But I am not sure about the method. I  want to download free app in my iPod touch device and i have the following doubts.  Kindly resolve me doubts.   when i try to download it asks my credit card security number. since i am trying to download free app , why do i need to provide my credit card security code? Will i be debited for downloading the free app from app store?   I cant able to find any information regarding this on apple.  Please provide me some references about this from apple and please resolve my doubts.  Thanks a lot. How can we prevent "assembly" tag being tagged to .NET assembly question I am seeing this happen again and again. Sometimes people tag the .NET and C# questions with "assembly" tag while in reality it belongs for Assembly programming questions. Using a Sprite image with input (a) Solve the equation $yu_x+xu_y=0$  with the condition $u(0,y) = e^{-y^2}$. (b) In which region of the xy plane is the solution uniquely determined?     I did the first part but I don't understand how to do part b.  I read   But I don't understand how the argument is based. A more clear explanation is appreciated C++ template typedef Wrongly set chmod / 777. Problems? I was trying to run chmod -R 777 ./ but ended up typing chmod -R 777 / and set 777 on my entire machine. What can go wrong? How can I fix it? Which Distribution Does the Data Point Belong to? I have two distributions which are derived from 2 separate sets of data. These distributions are not normal, and it is not clear at this point if they belong to any family of known pdfs (they are not symmetric either). Given a data point, I need to decide which distribution it is most likely to belong to. If these were normal distributions, I could do usual parametric tests and go from there, but in this case I am not sure how to proceed. I searched around a bit, but I couldn't find anything, probably because I am not using the right keywords. Any help is much appreciated.  Edit to clarify: I should have mentioned that it was univariate. I might as well explain the actual problem here as well. We have time-spent data for users on websites. We also have information on whether a user liked or disliked some of those sites (about 4% of all the sites). So we know the distribution of time spent for like and dislike. An obvious question, then, is for a random user who spent x amount of time, are they more likely to have liked the page or dislike the page. Our time spent information is based on seconds, so the distributions are really discreet, but in real life, they are continuous. Questions on "All Horse are the Same Color" Proof by Complete Induction How to adjust the gap between figure and caption within the same subfloat My question is:  How to adjust the gap between figure and caption within the same subfloat  Not the gap between two subfloat.  For the following example:  \begin{figure}     \centering     \subfloat[A]{\includegraphics[ scale=0.5]{images/a.jpg}}     \vspace{-10pt}     \subfloat[B]{\includegraphics[scale=0.5]{images/b.jpg}}     \vspace{-10pt}     \caption{}\label{fig:online_test} \end{figure}   I got the following figure:    The sub-caption of (a) is too close to the sub-figure B. I hope the caption (a) to stay closer to sub-figure A. How can I adjust the space between the caption and figure within a subfloat?  Thank you all for helping me and I would prefer a solution for subfloat, instead of using other packages. But I would also appreciate a solution of using other packages.   I know my question looks similar to . But please make it clear. I'm asking for how to adjust the gap between figure and caption within a subfloat, not the gap between two subfloat. That is, the gap between the caption "a" and the figure "A"  Thank you. Removed Windows 7 and installed Ubuntu Server 12.04, but Windows Boot Manager still appears Could someone please explain the role of the transistor in this circuit? I have a feeling it has to do with the LC circuit but I'm not sure and don't understand completely. The following is an image of the circuit (the transistor is n-type. It is used in lots of sensors to detect and generate ultrasonic waves. How to remove redundant {} from a nested list of lists? Comaximal ideals in a commutative ring Let $R$ be a commutative ring and $I_1, \dots, I_n$ pairwise comaximal ideals in $R$, i.e., $I_i + I_j = R$ for $i \neq j$. Why are the ideals $I_1^{n_1}, ... , I_r^{n_r}$ (for any $n_1,...,n_r \in\mathbb N$) also comaximal? Modify iPhone restrictions passcode Is there a way to change the restrictions passcode on an iPhone without restoring the phone? I haven't forgotten the passocde; I just want to change it. Your content must have a ListView whose id attribute is 'android.R.id.list' I'm sure everyone is familiar with the Ship of Theseus paradox, basically "If you replace parts of a ship over time until none of the original ship is left, is the end product still the same ship?"  I just read pop philosophy books, so spare me if this is an idiotic question, but could this be applied to the Brain and consciousness? If you were the take individual atoms/neurons, and somehow replace them with its exact copy one at a time, how would the person experience that?   I don't think there would be an interruption of consciousness, but at the end it's a completely separate (but identical) brain from the one you started with. Exactly as if you had just cloned the whole thing, right? But without interruption.  What interests me is the gradual transition of consciousness here, is it possible to know how that would  work?  I think I remember hearing people argue similarly for both the existence of a transcendent soul and also AI consciousness. And the only other discussion I found of this was on a flat earth forum, so I don't know what to make of that.   I hope I articulated my question clearly. Thank you! How to list all functions in a Python module?