« first day (1851 days earlier)      last day (2643 days later) » 

3:01 AM
@halirutan I'm not sure GeneralUtilities`PrintFormattedCode can help.
And thanks for your that code help,I'm wake up just now.
 
3:50 AM
How do I set ImageSize appropriately when the goal is to use the figures in a LaTeX document?
I export the figures as .pdf, and then typically include them using \includegraphics[width=\textwidth]{figure/figure.pdf}. The problem is that the text is smaller in the PDF document than in the Mathematica notebook due to scaling.
I would like to choose the text size or image size in Mathematica in such a way that it looks the way I want it in LaTeX.
@Szabolcs and others.
The template I'm using has \usepackage[top=3cm, bottom=3cm, inner=3cm, outer=3cm]{geometry} which defines the margins. The document is an A4 document.
 
 
5 hours later…
8:26 AM
@halirutan @LeonidShifrin I'd love to participate with that talk about heavy gui packages, @RolfMertig most likely too. I'd create a chat but it is quite tough to manage content there :)
Though it may be good for start with starring system as something to pinn important points.
 
9:07 AM
@C.E. What I do is that I do not set the size in \includegraphics (drop that \textwidth). Instead I prepare the figure to size. Do cm = 72/2.54 then Export["x.pdf", Graphics[{Circle[], Text[Style["foo", FontSize -> 12]]}, ImageSize -> 8 cm] ]
This will produce a 8 cm wide figure with 12 pt text. ImageSize does not scale the fonts at all.
 
@Szabolcs Thank you, this is exactly the kind of answer I was looking for. I had totally forgotten that the number of pixels per inch is known. On the one hand this information might look out of place in your MaTeX documentation, on the other hand a lot of people are wondering how to do this I bet. Thanks again.
 
 
1 hour later…
10:22 AM
@halirutan You mean you can upload image by your above code?
 
10:44 AM
@yode Sorry, I really don't have the time for that now.
@rcollyer What is a good way to test for "pink boxes" in Graphics in unit tests? Can I retrieve the pink box error messages programmatically?
0
Q: Unit tests for Graphics or FE boxes

SzabolcsConsider the following expression with bad syntax: Graphics[{foo}] How can I detect the error and retrieve the error message programmatically, so I can check for it in unit tests?

 
11:17 AM
@yode Yes, I could upload an image.
@C.E. We lately found out how to calculate the correct size of graphics for pdf export:
SetAttributes[imgSize, {Listable}];
imgSize::usage = "imgSize[magnitude,unit] creates the correct size that can be used for Mathematica graphics.";
imgSize[mag_?NumericQ, unit_] := QuantityMagnitude@
   UnitConvert[Quantity[mag, unit], "DesktopPublishingPoints"];
imgSize[mag_?NumericQ] := imgSize[mag, "Centimeters"];
With this, you can use Plot[.., ImageSize -> imgSize[8]] and as Szabolcs already said, you can just set the font-sizes directly and they are not changed.
 
@halirutan So it is a problem of web-server or my network?
 
@C.E. This is exactly how I prepare LaTeX document figures. I set the image size to a nice percentage of my \textwidth to make it look good. I fix the AspectRatio. I use the same font as in my LaTeX document (with Times you might want to use a Sans Serif font, but I'm using Palatino and I want to have it on the plots too). I'm using a fixed font-scheme that I use throughout the document.
In fact, I have about 2 or 3 possible image sizes and 2 or 3 possible AspectRatios to give me some freedom, but in general, I like to have a consistent style.
@yode Look here:
Done exactly 10 seconds ago..
And the uploaded image can be found here.
 
 
1 hour later…
12:44 PM
@Kuba Sure. For me, it's kind of hard to imagine such a discussion without you and @RolfMertig :). Communication options for a small group would include slack, Telegram, Facebook group - all of which would be more convenient than email exchanges, from my experience. I personally prefer Slack or Telegram, both provide excellent means for communication / collaboration.
 
1:05 PM
@halirutan In the paper I'm currently working on, I exported plot coordinates from Mathematica and did all the plots with TikZ/pgfPlots so that their style would match the rest of my document...however, I'm using only ListPlot rather than Plot, so I already have all the coordinates in array format
But surely there is a way to get Plot to spit out the coordinates it's plotted in List form
 
1:25 PM
@C.E. I suppose that really applies more to you. I highly recommend pgfPlots for getting plots that look consistent with your document!
 
@Szabolcs any idea why Get @ mypackage` failes while PacletInformation @ "mypackage" gives content? After RestartPacletManager[] or on a fresh kernel of course.
I'm not quite sure what went wrong, it used to work correctly.
And it is the case only with one paclet. Nevertheless, I failed to track a reason.
 
1:59 PM
@Kuba PacletInformation identifies the paclet by its name. Needs (and related functions) identify it based on the context that you set in PacletInfo.m. Check that the context matches, is valid and has the context mark.
 
2:09 PM
@Szabolcs added context but no success. It was working without context or Extensions/Kernel at all
Now I've changed version, installed, and it fails to load
@Szabolcs I've added $UserBaseDirectory/Paclets to $Path and it worked. And it is now working after restart
but I have no idea what was the problem and that may happen again
 
@Kuba That's strange, I was sure that paclets could not be loaded as a package if they did not have a kernel extension with the proper context set
 
@Szabolcs you were partially right, give me a sec to finish tracking what affect what
 
2:37 PM
@Szabolcs ok, so more than partially. I don't have time to check more but you are right. The problem was that I was experimenting with Name-x.y.z without -x.y.z and it was interfering. So yes for Needs and Get to find a paclet it needs to have Context in Kernel extension. The confusing part was that if you add this then you have to restart Mathematica, only RestartPacletManager[] is not enough.
At least on windows.
 
3:14 PM
@Kuba There is also RebuildPacletData[]. Don't remember if it is called by RestartPacletManager[] or not.
 
3:40 PM
@LeonidShifrin thanks, will try that next time :)
 
 
2 hours later…
5:11 PM
@Szabolcs that was partially answered here, but I responded to your new post with the full package I use and an example of usage as there are several quirks I've encountered since the original was posted.
 
5:59 PM
@halirutan Thank you, this is great
@BenNiehoff I Mathematica, and with MaTeX and a proper ImageSize it will look very consistent.
MaTeX is really a deal breaker though. Got to have that.
 
6:13 PM
@C.E. There is already written something about this in the guide, but it's not very detailed, and perhaps not very clear. I'll expand it in the future.
 
@Szabolcs Well, the guide says to choose a certain font size. But if you have to rescale the image in LaTeX because you don't know how to export the image with the right size, then the font size will be wrong anyway. I didn't find the post you linked to now, that would have helped too.
 
7:02 PM
meh, that was not a correct characterization of the guide. nvm.
 
7:48 PM
By the way, does anyone know how to turn off the little "news feed" thingy the pops up in the upper left corner of this chat page, if I leave the tab for a while and then come back to it?
 
8:24 PM
This question was closed as unclear what you're asking:
0
Q: How do I insert a circle inside another circle with Piecewise?

Iris GarzaI need to create two circles, where one circle is inside the other using the piecewise function. So far I have f[x_, y_, z_, a_] := Piecewise[{{1, x^2 + y^2 <= 30}, {0, x^2 + y^2 > 30},} I know by changing the radius I can have a circle inside the other, but how do I go about it using Piecewise?

Despite the attempt at a function being a bit odd the intent seems clear to me, and it seems that I am right as the OP Accepted my answer. I suppose this might be closed as a already has an answer, though I cannot think of a true duplicate at the moment, but it doesn't seem right to leave it closed for the given reason.
I prefer not to act alone in a case that would "favor" my own answer.
@BenNiehoff I don't know, but I have to ask: why not leave the room and return to a bookmark? Or perhaps I misunderstand.
 
8:54 PM
@Mr.Wizard Actually, I think it's not a chat specific thing. It's a news feed that shows the new questions that have been posted to Mma stack exchange...kind of annoying, since I already know where to look if I want to see those
oh well
 
@BenNiehoff I barely notice that feed so I probably don't quite remember how it works. I thought however it only showed items that happen while you are in the chat room. If you leave the chat room and return later I don't think you get a feed with every new question that was posted while you are away. Or at least I don't believe I do.
 
@Mr.Wizard Sure, but I often leave the chatroom open while doing other things and then periodically tab over to it
 
@BenNiehoff Do you have need to do that rather than actually leaving and returning? It would appear to be a solution.
 
It's faster? :P
I have literally 150+ tabs open in FireFox. Maybe you don't like that, but it's how I function. shrug
 
@BenNiehoff I cannot argue with that, but at the same time leaving a tab open shows you as being "present" in the room when you are not.
 
9:01 PM
True, but that's not entirely uncommon
It shows about 10 people "present" at the moment
 
@BenNiehoff lol you have no idea; I am the worst abuser of tabs ever. I even installed an add-on to count them. At the moment I have 1022 tabs open. :-p I still leave the chat for the very reasons we are discussing.
 
lol
A few weeks ago my browser crashed hard enough to lose all my tabs...was a very frustrating experience
Since I use them to remind me of things I was interested in reading
 
And yes, if you have a tab open and it shows you as "present" you are far from alone. It's done all the time.
 
So I actually went through my History and recovered most of them...and even (gasp!) put some of them in bookmarks
which I then forget about entirely, of course :D
 
@BenNiehoff You need to back up your tabs! In Firefox there is a file in your user profile, I think it is sessionstore.js
 
9:05 PM
My Firefox is alread set up to remember tabs when it closes
it usually does, even if it crashes
but this time was different
 
That is not the same thing. If that file becomes corrupted you lose your session tabs as you have experienced. You need to copy this file elsewhere to be safe.
 
ah, I see
I figure it's my own fault for relying on tabs to organize my frequently-visited webpages
it's only happened once in like years
by the way, how to I pasted multiple lines of code into chat?
*how do I paste
 
However even if you do not have a manual copy the system has probably made one for you. For future reference if you were to right-click on sessionstore.js there is probably a menu item Restore previous versions and you can click that to load a back-up copy made by Windows.
Sorry, I just realized I assumed you are a Windows user.
 
I am, but I don't remember Windows offering that sort of option on just any file
amazing, the option is there! never noticed it before
 
Not just any file, but the ones in C:/Users/name/AppData I think.
@BenNiehoff Glad to be of help! :D
 
9:09 PM
for my important stuff I'm just using git
 
@BenNiehoff Let me make sure I am giving correct instructions; I'll test my memory
Okay, yes, if you simply paste the code by itself into the comment box you should see a new button appear to the right: fixed font -- click that and it should format your comment as code.
 
ok, I will try
I wanted to post this for the room's amusement:
Quine = Function[{},
   Module[{code, quote},
    code =
     "Quine=Function[{},\nModule[{code,quote},\ncode=\"[CODE]\";\n\
quote=Function[{string},\n\
With[{escaped=StringReplace[string,{\"\\\\\"\[Rule]\"\\\\\\\\\",\"\\n\
\"\[Rule]\"\\\\n\",\"\\\"\"\[Rule]\"\\\\\\\"\"}]},\n\
StringReplace[string,{\"[CO\"<>\"DE]\"\[Rule]escaped}]]];\n\
quote[code]]];";
    quote = Function[{string},
      With[{escaped =
         StringReplace[
          string, {"\\" -> "\\\\", "\n" -> "\\n", "\"" -> "\\\""}]},
 
@BenNiehoff nice :^)
 
thanks
I'm sure it is not the shortest one
 
9:55 PM
@BenNiehoff Those feeds were explicitly added to this room chat.stackexchange.com/rooms/info/2234/…. We added it about 5 years ago when the volume of questions on main was very low, but chat participation was very high. The feeds allowed everyone to respond to questions in real-time, thus driving up participation on the site. Now that chat participation has gone down, it might be annoying for people like you that never leave the room :)
 
0
Q: how do I paste multiple lines of code into the chat (in the chatroom)?

andreThe only way I know to copy multi lines of code into the chat is to copy one line by one line and for each line inserting a ` at the start and at the end. I have searched informations all over the site but was not successfull.

 
I would be happy to remove the feeds from other sites that are related to Mathematica (e.g. questions from Mathematics or Stack Overflow). Those were useful back then, mainly as a way to target new users and redirect them to this site, but we've been established for a long time now and don't do this anymore. The only ticker feed left will be new questions on this site, which I think is still useful.
 
10:24 PM
@R.M. Ah, ok, I see how that would have been a good idea at the time
 

« first day (1851 days earlier)      last day (2643 days later) »