I am trying to increase the size of the legend such that it exactly fits to size of the plot. But even after having a look at the PGF manual I could not figure out how I can realise my plan. Afterwards I want to equally distribute the legend entries within the box.  UPDATE  The actual solution was:  \def\WIDTH{7cm} \def\INNERSEP{3pt}  \begin{axis}[     xmin=1, xmax=10, xtick={1,...,10}, xmajorgrids=true, xlabel={Cores},     ymin=0, ymax=100, ymajorgrids=true, ylabel={MFLUPS/s},     scale only axis,  % &lt;==== !!!!!!!     extra description/.code={         \node[         draw,         text depth=0pt,         at={(current bounding box.north-|current axis.north)},         anchor=south,         text width=\WIDTH-2*\INNERSEP,         inner sep=\INNERSEP,         outer sep=0pt,         ] {     \hbox to \linewidth{%         \hfill \ref{A} A \hfill \ref{B_B} B \hfill         }%     }; }, ]        \documentclass{standalone}  \usepackage{tikz}  \usepackage{pgfplots} \pgfplotsset{compat = newest}  \begin{document} \pgfplotsset{width=7cm} \begin{tikzpicture}  \begin{axis}[     xmin=1, xmax=10, xtick={1,...,10}, xmajorgrids=true, xlabel={Cores},     ymin=0, ymax=100, ymajorgrids=true, ylabel={MFLUPS/s},     legend style={         at={(current bounding box.north-|current axis.north)},         anchor=south,         legend columns=-1,         outer sep=0     }] \addplot [mark=square*, mark options={solid}, thick] table { 1   10 2   20 3   30 4   40 5   50 6   65 7   70 8   80 9   90 10  95 }; \addlegendentry{Graph A} \addplot [mark=*, mark options={solid}, thick] table { 1   10 2   20 3   25 4   40 5   25 6   65 7   70 8   25 9   90 10  95 }; \addlegendentry{Graph B} \end{axis} \end{tikzpicture} \end{document}
I am trying to customize the legend for this graph. First of all, I would like the legend width to be equal to the x-axis width. At the moment, I am setting the width of the legend via      /tikz/every even column/.append style={column sep=1.0cm}   and I could manually adjust this value so that length equals the x-axis width, but I guess that there is a more elegant way to set the width of the legend.  Second, I don't really like the little color rectangles in the legend. I only want one rectangle in front of every entry and not two. This rectangle does not need to have a border and should be vertically centred with the text. The alignment seems to be okay for the rectangle closer to the text, but not for one the far left.   Update: Thanks to Christian Feuersänger's comment, there is possibility to change the rectangles via   legend image code/.code={%     \draw[#1, draw=none] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);   or what Gonzalo Medina proposed  legend image code/.code={%     \draw[#1, draw=none, /tikz/.cd, bar width=3pt, yshift=-0.2em, bar shift=0pt] %     plot coordinates {(2*\pgfplotbarwidth,0.6em)};   Third, I would like to the legend entries to start next to the text "Legend:".  I don't really know if with these requirements it still makes sense to use legend or if it would be better to add everything manually via after end axis/.code and \ref{label}.  Graph    MWE  \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest}  \begin{document} \begin{tikzpicture}     \begin{axis}[                 ybar,                 height=6cm,                 title={Some plot},                 width=12cm,                 axis on top,                 y axis line style={opacity=0},                 axis x line*=bottom,                 tick align=inside,                 tick style={draw=none},                 xtick=data,                 ymajorgrids,                 major grid style={draw=white},                 xtick={1,2,3,4},                 legend style={                     at={(0.0,-0.15)},                     anchor=north west,                     legend columns=-1,                     /tikz/every even column/.append style={column sep=1.0cm}                         },             ]                    \addlegendimage{empty legend}             \addlegendentry{\textbf{Legend:}}                                \addplot coordinates {                 (1, 0.2064)                 (2, 0.3961)                 (3, 0.5961)                 (4, 0.7961)}; \addlegendentry[text width=45pt, text depth=]{legend a}             \addplot coordinates {                 (1, 0.3064)                 (2, 0.4961)                 (3, 0.6961)                 (4, 0.8961)}; \addlegendentry[text width=65pt, text depth=]{lengend b}     \end{axis}  \end{tikzpicture} \end{document}
How to get apt-cacher-ng to download AND cache packages from Apt HTTPS repositories? I think my MacBook Pro battery was replaced by Apple's service team. How do I check that? Pattern in Isomorphisms between $\mathbb Z_m \times \mathbb Z_n$ and $\mathbb Z_{mn}$ In general, the group $\mathbb Z_{mn}$ under addition $\bmod mn$ is isomorphic to the direct product $\mathbb Z_m \times \mathbb Z_n$ if and only if $\gcd(m,n)=1.$ This is easy to see since $\mathbb Z_{mn}$ is generated by the element $(1,1)$, and if $\gcd(m,n)=1$, then this will only be zero if it is multiplied by itself $mn$ times (resulting in the cyclic group).   However I'm interested in constructing an isomorphism between the two groups as an explicit expression. I've been playing around a bit with some examples, one of which is the function $\phi : \mathbb Z_2 \times \mathbb Z_3 \to \mathbb Z_6$ where $\phi(a,b) = 3a + 4b \pmod 6$, which gives us the desired isomorphism. I'm interested here in the relationship between the integers $2$, $3$, and the coefficients $3, 4$ of $a$ and $b$. After playing around in Wolfram|Mathematica, I managed to obtain the following isomorphisms $\phi_{m,n} : \mathbb Z_m \times \mathbb Z_n \to \mathbb Z_{mn}$ for coprime $m,n$ in $\{1, 2, \dots, 10\}$.   First of all, the following results seem to hold in general.  $$\phi_{1, n}(a, b) = a + b \qquad \text{for all $n$}$$  $$\phi_{m, 1}(a, b) = a + b \qquad \text{for all $m$}$$  $$\phi_{2, n}(a, b) = na + (n + 1)b \qquad \text{for all $n$}$$ $$\phi_{m, n}(a, b) = K a + L b \iff \phi_{n,m}(a, b) = L a + K b \qquad \text{for all $m, n$}$$  Beyond this point, I could not spot a general pattern. The isomorphisms I obtained are:  $$\phi_{3, 4}(a, b) = 4a + 9b$$ $$\phi_{3, 5}(a, b) = 10a + 6b$$ $$\phi_{3, 7}(a, b) = 7a + 15b$$ $$\phi_{3, 8}(a, b) = 16a + 9b$$ $$\phi_{3, 10}(a, b) = 10a + 21b$$ $$\phi_{4, 5}(a, b) = 5a + 16b$$ $$\phi_{4, 7}(a, b) = 21a + 8b$$ $$\phi_{4, 9}(a, b) = 9a + 28b$$ $$\phi_{5, 6}(a, b) = 6a + 25b$$ $$\phi_{5, 7}(a, b) = 21a + 15b$$ $$\phi_{5, 8}(a, b) = 16a + 25b$$ $$\phi_{5, 9}(a, b) = 36a + 10b$$ $$\phi_{6, 7}(a, b) = 7a + 36b$$ $$\phi_{7, 8}(a, b) = 8a + 49b$$ $$\phi_{7, 9}(a, b) = 36a + 28b$$ $$\phi_{7, 10}(a, b) = 50a + 21b$$ $$\phi_{8, 9}(a, b) = 9a + 64b$$ $$\phi_{9, 10}(a, b) = 10a + 81b$$ If you want to try and generate a few yourself, here is the Mathematica function I implemented. I'm sure it can be optimised, but for the first 10 coprime integers it sufficed.  isomorphism[{m_, n_}] :=       Module[{x = Null},       For[i = 1, i &lt; m*n,           i++, (If[#[[2]] == Table[i, {i, 0, m*n - 1}],           x = ToString[#[[1]][[1]]] &lt;&gt; "a+" &lt;&gt; ToString[#[[1]][[2]]] &lt;&gt;          "b"; Break[]] &amp;) /@       Table[{{i, j},       Mod[i #[[1]] + j #[[2]], m*n] &amp; /@       Table[{Mod[i, m], Mod[i, n]}, {i, 0, m*n - 1}]}, {i, 1,      m*n}, {j, 1, m*n}][[i]]]; x];   I'd appreciate if anyone can help me find the pattern to determine $\phi_{m, n}$ in general. Interchanging the order of differentiation and summation Related:   I know I must describe my past and current research in my personal/research statement or statement of purpose. But do I use technical terms?  I was given the advice that since the people reading my statement are mathematicians (I am applying to US for applied mathematics), they should know what I am talking about.  Although I am applying to applied mathematics, it would also be nice to hear from other fields (biology, computer science, engineering etc) about this. The bug displayed in the attached screenshot occurs consistently for me while running the developer beta of iOS 10 using v1.5.2 of the Stack Exchange app on an iPhone 6.  I was able to recreate this by simply tapping on any question or answer in my feed with a long title. This doesn't appear to be a bug with iOS 10 itself since I haven't seen it in other apps, but I could be wrong. Why do we say "last night" and not "yesterday night"? As from object, is there a rational reason for saying "last night" rather than  "yesterday night", though you would say "yesterday morning" and "yesterday afternoon"? Normal text is invisible when using beamer with notes and XeLaTeX I have an armature set up, but the bones aren't moving the mesh properly  The mesh and armature:    The vertex group of the bone I am going to move:    As you can see, the circled region doesn't belong to the vertex group. But, when I move the bone look what happens:    That part of the mesh has moved with the bone.. Why? Let $X$ be obtained by removing finitely many lines from $\mathbb{R}^3$. How do I prove $X$ is connected? Let $X$ be obtained by removing finitely many lines from $\mathbb{R}^3$. How do I prove $X$ is connected?  I think the way to go about this is to show $X$ is path-connected but I'm not quite sure. General closed form of $\int_{0}^{\theta_0} \frac{1}{\sqrt{\cos \theta-\cos \theta_0}} d\theta$ I once asked a  about how to integrate the reciprocal of the square root of cosine.  Is  there a general closed form for the integral $$\int_{0}^{\theta_0} \frac{1}{\sqrt{\cos \theta-\cos \theta_0}} d\theta$$   in terms of the gamma function?  Thank you. How to show equinumerosity of  the powerset of $A$ and the set of functions from $A$ to $\{0,1\}$ without cardinal arithmetic? Why is this markdown for a link not showing properly? The Stack Exchange (Personal Productivity) markdown  is showing literally rather than as a named link. Don't know why. How to fix sculpting ridges? I ran into a problem I have never seen before and that is when I try to sculpt on a mesh, it sculpts like this:  Instead of this: I am using dyntopo with these settings:   I feel like theres a very obvious solution to this, but I have no idea what it is. What effect does serial downvoting have on my rep cap? So I was the victim of serial downvoting the other day, and just had it automagically reversed. Rather than simply removing the previous votes, I was given a bonus lump of rep with the reason "serial downvote reversal". The downvotes and the bonus show up on different days. Since a whole day's quota worth of downvotes equates to quite a fraction of my daily rep cap, what happens in the following circumstances?   I get 200+ rep on a particular day, but I am serial downvoted (later reversed) back to under 200. Does this day count as reaching cap? I get 200+ rep the next day, and I am also credited back the rep. Is the rep bonus immune to the rep cap in the same way bounties are? On the day I get my rep bonus, it is enough to take me to 200 rep. Does this count as capping? I have this problem I'm working on. Hints are much appreciated (I don't want complete proof):  In a normed vector space, if $ x_n \longrightarrow x $ then  $ z_n = \frac{x_1 + \dots +x_n}{n} \longrightarrow x $   I've been trying adding and subtracting inside the norm... but I don't seem to get anywhere.  Thanks! Show that $\left| \frac{1}{x}-\frac{1}{z} \right| \le \left|\frac{1}{x} - \frac{1}{y} \right| + \left|\frac{1}{y} - \frac{1}{z} \right|$. I'm trying to prove that  $$ \left| \frac{1}{x}-\frac{1}{y} \right| $$  is a metric on $X = \mathbb R^+$.  The properties of non-negativity and symmetry are obvious (do I actually even need to prove them?), but the tricky one is, as usual the inequality property, i.e.  $$ d(x,z) \le d(x,y) + d(y,z) \text{ for any } z \in X. $$  So, ok, I have that  $$ d(x,z) \le d(x,y) + d(y,z) \\ \iff \left| \frac{1}{x}-\frac{1}{z} \right| \le \left|\frac{1}{x} - \frac{1}{y} \right| + \left|\frac{1}{y} - \frac{1}{z} \right| \\ \iff \left| \frac{1}{x} \right|- \left| \frac{1}{z} \right| \le \left| \frac{1}{x}-\frac{1}{z} \right| \le \left|\frac{1}{x} - \frac{1}{y} \right| + \left|\frac{1}{y} - \frac{1}{z} \right| $$  ...and that's about as far as I've gotten–which is to say, not very far. I also tried multiplying both sides by $ \left| \frac{1}{x}-\frac{1}{z} \right| $, but that wasn't very fruitful. If someone could point me in the right direction, it'd be greatly appreciated. Thanks. Proving this identity $\sum_k\frac{1}{k}\binom{2k-2}{k-1}\binom{2n-2k+1}{n-k}=\binom{2n}{n-1}$ using lattice paths Since one or two months ago, my laptop with ubuntu 12.10x64 hangs during shutdown. There's just a black screen, no harddisk activity, it justs sits there. I feel it happens near the end of a normal shutdown cycle, judging from time elapsed.  Only resolution is hard power-off (holding power key for several seconds) - neither Ctrl-Alt-Backspace (which normally works, I have it switched on in Settings) nor Ctrl-Alt-Del help, nor can I get into a text console with Ctrl-Alt-F1.   How do I diagnose that? It does not happen on every shutdown, but often enough to be annoying (as it forces a diskcheck on reboot, of course).   Which log files can tell me what's going wrong? More or less blindly searching in the sys log viewer reminds me of needles in a haystack.  I imagine I could pinpoint the time it happens via log timestamps, but how do I read timestamps like e.g. in kern.log: [36169.146130]? How do I get this human-readable?  Lastly, a bit of a btw, I've never managed to execute an Alt-Sysrq-REISUB to force a cleaner shutdown, but that's probably because I'm on a laptop, PrintScr is only accessible via an Fn key, and I'm not sure of the exact key sequence I need. Is there a "harmless" but user-visible magic command I could practice this with (during normal operation), so I can find out how to do a REISUB next time?  Thanks all! Comment if you need additional data... Why is it so hard to find the roots of polynomial equations? The question that follows was inspired by  question:  When trying to solve for the roots of a polynomial equation, the quadratic formula is much more simple than the cubic formula and the cubic formula is much more simple than the quartic formula.    That the general solutions to various polynomial equations are so complex and difficult to derive seems to suggest a fundamental limitation in the problem solving capabilities of the mathematical machinery. Does this intuition of mine make any sense? What should I make of it? Why is it that with each successive degree in a polynomial equation, the solution becomes so much more complex? Can I gain some intuition about what makes finding the roots so hard? According to the : "there is no general algebraic solution—that is, solution in radicals— to polynomial equations of degree five or higher." What is so special about the quintic that makes it the cut-off for finding a general algebraic solution?