tag:blogger.com,1999:blog-67021577572608861112024-03-13T12:00:46.472+00:00The Splendid Fishpaste AuditoriumAlihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.comBlogger54125tag:blogger.com,1999:blog-6702157757260886111.post-40315289684791726422013-02-26T16:27:00.003+00:002013-02-26T16:28:38.235+00:00Making a book with scribus and blurb (and other open-source friends)I like to make books to publish with <a href="http://www.blurb.co.uk/">Blurb</a>, and I like to have full creative control of the process and work offline. They have some lovely software to download, apparently, but if you click "not on Windows!", it offers you another version of the software and the button changes to "not on Mac!", and if you click button that it goes back to "not on Windows!". Sigh. So, for those of us taking the third linux-y way, we have the wonderous <a href="http://www.scribus.net/">Scribus</a>.<br />
<br />
I'm no expert, but I've done this twice now, and thought I'd post the settings and steps that worked for me.<br />
<br />
First a disclaimer:<br />
<br />
I'm no photographer. I don't care much for colour profiles except ones that make it work, and I don't much understand what I'm doing in that department. I post settings here that have worked for me, and make no guarantees they will work for you. My monitor is certainly NOT colour-calibrated. <br />
<br />
So, here are the steps I go through to make a book with Scribus and Blurb.<br />
<br />
1) Assemble all your stuff in a folder. Plan your book thoroughly by sorting a rough layout and choosing what goes on what page. You could do this on paper, or I like to make a rough layout in something like <a href="http://www.libreoffice.org/features/impress/">LibreOffice Impress</a>. Anything quick to plop in some pictures. This step helps you find how many pages you'll need for your book and I can't stress how important it is to know that before starting! I can't imagine the bother if you decide to add more later and blurb decides your measurements need to change and you have to re-tweak the positions of all your images. Gah! Although probably it wouldn't change by too much and maybe you don't care about image positions to the nearest pnt...<br />
<br />
2) Find out what your book measurements will be. This is on the <a href="http://www.blurb.co.uk/pdf_to_book">"PDF to book"</a> section of Blurb's website, and you need to "get specs". You'll be invited to choose things like paper-type, book size, number of pages and cover type. Remember which you picked because you have to tell Blurb what you chose when you come to upload your PDF. I print this page to file for easy reference during the design process. By number of pages, Blurb means printed sides of paper, not leaves of paper, and it has to be an even number to include the first page on the right when you open the book, and the last page on the left as you close it. Reminds me of the argument with my husband over what constitutes a "round of sandwiches". Anyway, I like to work in points for measurements and so does Scribus.<br />
<br />
3) Set up your Scribus project for the pages! Since blurb uses single pages not traditional signatures, so choose "single page", then how many single pages you want. First page is set to right. The width and height should be set to the page size/trim line as your finished book will be, the extra bleed space is added with the "bleeds" tab. Note that when working on the pages, the coordinate (0,0) is at the top left of the page trim, inside the bleed area. The absolute top left of the pdf page will be (-x_bleed,-y_bleed). Finally, I set margins so as to define the safe boundaries. You're done, and Scribus displays your pages nicely side-by-side as if you opened the book: great for sorting those double-page spreads.<br />
<br />
4) Set up a separate Scribus project for the cover. I use single page again, and add guides to show me where with spine and flaps are. Add these under Page>Manage Guides, and take heed of the co-ordinate system as noted above.<br />
<br />
5) Set up colour management for each of your projects. First obtain the Blurb colour profile from <a href="http://www.blurb.co.uk/color-management">here</a>. Copy it to /usr/share/color/icc and re-start Scribus. For each project, activate colour management from File>Document Setup>Colour Management. I have RGB images, colours and monitor set to sRGB, and CMYK colours, images and crucially the printer set to the Blurb profile. The other settings I left as "perceptual", "relative colourimetric" and blackpoint compensation on. My images I left as RGB, some of which have embedded profiles (from the digital camera), some do not (from my scanner). You can find out more about your images using the <a href="http://www.imagemagick.org/">ImageMagick</a> tool, see this <a href="http://www.imagemagick.org/Usage/formats/#profiles">page</a>.<br />
E.g. to find if there are any profiles:<br />
identify -verbose myimage.jpg | grep 'Profile-.*bytes'<br />
... omit the grep part to just see a load of stats about the image, including which colourspace.<br />
<br />
6) Make your pages and cover. Scribus is nice in that you can see image resolution as you scale the image, so you can be sure not to reduce it too much below 150dpi. Scribus also has some cool effects you can apply to your images (e.g. greyscale), but beware that the PDF/X-3 standard that blurb requires does not support transparency. I have got round this in the past by working out how to produce the effect I wanted using e.g. <a href="http://www.gimp.org/">gimp</a>, then flattening transparency (removing the alpha channel to just get RGB) before exporting as an image to stuff into Scribus. I think this is Image>Flatten Image in gimp.<br />
<br />
7) Export as PDF. File>Export>Save as PDF. Under the GENERAL tab, ensure you choose PDF/X-3. Under the Pre-Press tab, make sure you tick "use document bleeds" to ensure they're added to your PDF page size. Failure to do this will result in Blurb rejecting your files with page sizes that are too small! Under "Output Intent", the output profile should be set to the Blurb CMYK profile you downloaded earlier.<br />
<br />
8) Preview and double-check your pages and cover documents as PDFs. As well as checking content, check page size. I've found that some readers (Cairo document viewer) show the wrong page size, but the right colours, while others (adobe reader) show the right page size but crazy colours. You can get adobe to show measurements in points under Edit>Preferences>Units.<br />
<br />
9) Upload to Blurb and cross your fingers for a happy pre-flight check.<br />
<br />
Final tip: with having full control of the book design, it can be tempting to go wild with all the possible effects. I note that this does not lead to a more exciting book, but a rather scrappy unprofessional one with no uniting theme. I recommend to pick a style and stick to it religiously. Exactly what I didn't do with my last book, and it shows ;-) Remember: more fonts does not a better document make.<br />
<br />
Hope these tips might be useful to someone out there! Happy bookmaking. Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com4tag:blogger.com,1999:blog-6702157757260886111.post-55451633378207621542011-10-02T19:43:00.004+01:002011-10-02T20:19:30.768+01:00Broken Beko washing machine spins really fastI know this is a tedious blog about fixing my computer problems, but since I feel duty bound to give information back to the interwebs after it's helped me, I hope a post about washing machine fixes will be acceptable.<br /><br />So, here's hoping this post will turn up for people google-ing for the same problems as me this morning.<br /><br />My Beko WMA520W washing machine broke last night. Half way through a wash there was a "wheeee!" noise and the drum stopped. We turned it off and took the laundry out. Thereafter, every time I turned it on, it pumped water out, then spun really fast, then stopped. Even turning it off at the wall or holding down the cancel button would not re-set it, as it was convinced it was mid-cycle.<br /><br />I bring you a two-part solution. First, according to <a href="http://www.fixya.com/support/t1148348-beko_aa">this post</a>, there is a magic raindance on the front control panel to re-set the machine:<br /><br /><ul><li>Turn the power button off but leave the machine on at the wall</li><li>Select a 90 degree wash</li><li>Hold the start/cancel button down for 3 seconds and turn the power button on whilst still holding buttons down. The start light will flash.</li><li>Select any spin position.</li><li>Hold down the start/cancel button again for 3 seconds. If other buttons start to flash, press start/cancel again for 3 seconds.</li></ul>Now the machine is happy to accept instruction. We tried a nice rinse cycle, with the machine empty. It filled with water okay, but when it got to tumble-time, the drum just span up to warp speed again, then stopped.<br /><br />After checking various things, we removed the motor and the issue turned out to be a shattered tachometer magnet. The magnet pieces no longer rotated with the motor shaft, so there was no induced current in the tacho coil. The control unit therefore assumed the motor was not rotating, so increased the speed until it reached some safety cut-off.<br /><br />In this model, the magnet appears to have been formed around a textured brass ring, so even if spares were available (and <a href="http://www.ukwhitegoods.co.uk/forumsphpbb3/viewtopic.php?f=34&t=65169">the internet</a> doesn't seem to have any) it seems unlikely you could get a replacement on without shattering it. We opted for some Araldite Rapid Steel epoxy and have tried to glue the two pieces back together. This may not last us very long, and we don't intend to leave the washer on when we're not around, just in case! It we want a longer-term fix, it seems the only option is to buy a whole new motor which seems a bit stupid just for a magnet, but hey ho. We'll try the £5 fix over the £80 one any day. Of course, the third option is to obtain the new motor less expensively by cannibalising other Beko machines at the skip or otherwise obtaining a broken one for spares.<br /><br />Other news from my fascinating journey round the Beko's guts:<br /><br />We've always had to pour another 20 litres of water through the tray on a wash cycle as the machine doesn't put anywhere near enough water in. However, it looks like we can make adjustments on the fill pressure sensor (top front right corner) in the future, but let's break one thing at a time for now.<br /><br />Some corners of the web mention timing wheels and other such nonsense. I didn't see any of those inside our beastie, so I conclude most of the control goes on inside the processor (an Atmega32). When that gets toasted, it'll be £50 for a new board :-(Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com6tag:blogger.com,1999:blog-6702157757260886111.post-21464003530820303922011-09-05T21:02:00.002+01:002011-09-05T21:07:28.677+01:00Linux hostnameThis shouldn't have taken me so long. My husband wouldn't name his new laptop after a popular British F1 driver, until I managed to change the desktop hostname to that of his team-mate. The desktop was previously so named because it was so fast (ha ha oh).
<br />
<br />Anyway, the answer was to add
<br /><div style="text-align: center; color: rgb(204, 204, 255);">HOSTNAME="F1driver"
<br /></div>to <span style="color: rgb(153, 153, 255);">/etc/sysconfig/network</span> (since it wasn't already there for me to change). Alternatively, I could have done
<br /><div style="text-align: center; color: rgb(153, 153, 255);">sysctl kernel.hostname=F1driver
<br /></div>as superuser.
<br />
<br />It's a win.
<br />Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com1tag:blogger.com,1999:blog-6702157757260886111.post-4186794480527863412010-11-16T08:09:00.003+00:002010-11-16T08:26:19.116+00:00Equation referencing in Word 2007It baffles me that something so essential is not simple with micro$oft word. If you are going to want to put equations in your document, <span style="font-style: italic;">of course</span> you will want to talk about them! (Otherwise, why bother?) To talk about them, <span style="font-style: italic;">of course</span> you will need to reference them and the best way of doing that is with numbers. Why then is there no simple way to do this? Why give an equation tool but no easy numbering method?<br /><br />So: how to insert a numbered equation in Word 2007 and reference it in the text. For the first part, I follow <a href="http://blogs.msdn.com/b/microsoft_office_word/archive/2006/10/20/equation-numbering.aspx">this blog post</a>.<br /><ol><li>Insert a 3 column, 1 row table.</li><li>Format the table to fill 100% of the page width, with the column widths in percent as 15:70:15.</li><li>Centre the text in the middle column and remove all table borders. Make the spacing below the table the same as other paragraphs.</li><li>Insert your equation in the middle column. (I use insert>object>M$ equation 3.0 since the new equation package won't work on my machine).</li><li>Insert a number in the right-hand column by insert>multilevel list. You can define your own so that the numbers are formatted like (x).<br /></li></ol><p>Here is the nice part (ha ha). Since my "equation gallery" is broken too, I can't save these shenanigans for easy re-use. To insert a new equation later, I simply copy the whole table and paste it elsewhere and change the equation! The numbers automatically sort themselves out (hallelujah).<br /></p><p>To reference the numbered equation in the text:</p><ol><li>Highlight the equation number and insert>bookmark. Give it a nice name.</li><li>Put the cursor at the place where you want your reference inserted and insert>cross-reference. Insert a reference of type "bookmark", select the name of your equation and insert the reference to the paragraph number (full context).<br /></li></ol> <p>There. That was a complete pain, wasn't it? And it took about 40 mouse-clicks! Doesn't your equation look horridly rendered too? Oh, I love LaTeX and I want it back.</p>Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com1tag:blogger.com,1999:blog-6702157757260886111.post-3852443535562654322010-10-29T18:45:00.003+01:002010-10-29T18:51:46.695+01:00Save excel graphs as vector imagesThis is a lame workaround to get excel plots as vector images.<br /><br />Select your Micro$oft Excel plots. Copy. Open Micro$oft PowerPoint. Paste-special as enhanced metafile (emf) into an otherwise empty slide. Save your PowerPoint slide as an "other format" file (on the 2007 menu), and choose "emf" (an enhanced <span style="font-style: italic;">windows</span> metafile! wow!). Import your emf file into <a href="http://inkscape.org/">inkscape</a> and ungroup the object. Delect all the a4-sized crappy blank space from the image and enjoy.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com1tag:blogger.com,1999:blog-6702157757260886111.post-80210468914025782322010-10-29T18:35:00.003+01:002010-10-29T18:44:54.617+01:00Excel axis labels workaround<span style="color: rgb(153, 153, 255); font-weight: bold;">Problem:</span><br />When making an x-y scatter plot in Micro$oft Excel 2007, there appears to be a bug which prevents the x-axis tick labels displaying correctly (at least on my machine). When you set the x-axis tick labels to text, e.g. "apple", "banana", "pear"..., the chart just displays the labels as 1, 2, 3... even when you are careful to select the cells containing the text labels as your x-data, and despite them showing up correctly in the "select data" dialogue box. This only appears to be an issue for the x-y scatter plot type.<br /><br /><span style="color: rgb(153, 153, 255); font-weight: bold;">Workaround 1:</span><br />Install linux boot disc...<br /><br /><span style="color: rgb(153, 153, 255); font-weight: bold;">Workaround 2:</span><br />Add a new dummy data series to your graph with x = {"apple", "banana", "pear"...} and y = {0, 0, 0...}, or some other value below the y-axis minimum. Select only this series, and set the chart type to area. The x-axis tick labels should now display correctly for the whole chart. Obviously delete the dummy data label from your legend, if you have one.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-21525664982415052052010-10-01T19:21:00.002+01:002010-10-01T19:40:06.169+01:00Stupid papersize stupid stupidAfter finally getting to the stage where my thesis would compile on a different computer (see last post to install the extra .sty files), I then discover my page headers have disappeared on my pdf output. It turns out that this is due to the default ps2pdf setting being US letter paper, rather than the A4 size that the rest of my document is on. The answer (for the moment, anyway) is this:<br /><span style="color: rgb(153, 153, 255);">ps2pdf -sPAPERSIZE=a4 thesis.ps</span><br />I'm forced to go a-latexin' followed by dvipsin' then ps2pdf because of some bounding box issues with my images with pdflatex that I can't be bothered to solve.<br />That will serve me right for having a typo in my thesis.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com1tag:blogger.com,1999:blog-6702157757260886111.post-30892480868401757602010-09-30T07:27:00.004+01:002010-09-30T07:33:53.896+01:00Installing a latex .sty fileI've never managed to successfully do this until now. Here's the deal:<br />1) download & unzip the package from CTAN<br />2) run latex on the .ins file so that it creates a .sty file<br />3) find out what your computer thinks your TDS tree should be:<br /><span style="color: rgb(153, 153, 255);">kpsewhich -var-value TEXMFLOCAL</span><br />(mine says "<span style="color: rgb(204, 204, 255);">/usr/local/share/texmf</span>")<br />4) create the tree <span style="color: rgb(204, 204, 255);">/usr/local/share/texmf/tex/latex/<package></span> if it isn't already there (where <package> is the name of your sty file)<br />5) paste in your .sty file<br />6) run <span style="color: rgb(153, 153, 255);">mktexlsr /usr/local/share/texmf/</span><br />7) profit.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-60689418757935850682010-08-16T17:35:00.002+01:002010-08-16T17:49:43.136+01:00Including pdf files into latexFurther to my <a href="http://morecakelessfish.blogspot.com/2010/08/latex-coloured-text-and-blank-page-fun.html">earlier post</a> today, this post is the story of how I managed to get my research papers into my thesis as appendices. The earlier post tells a fascinating tale of how I sorted the page counters out and forced some blank pages. I then compiled up to pdf (via ps2pdf, to include my eps diagrams). To insert my other pdf pages I wrote a new latex file to stitch stuff together using pdfpages. Sadly this makes my hyperlinks go away, but nevermind. The object here is to be able to have a file which can be printed and bound by people who don't care to re-arrange pages for me. Behold:<br /><br /><span style="color: rgb(153, 153, 255);">\documentclass[a4paper,portrait]{article}</span><br /><span style="color: rgb(153, 153, 255);">\usepackage{pdfpages}</span><br /><br /><span style="color: rgb(153, 153, 255);">\begin{document}</span><br /><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={1-32}]{thesis.pdf}</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={33-34}, landscape, turn=false]{thesis.pdf} % some landscape pages</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={35-202}]{thesis.pdf}</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={1-5,{},{},{}}, landscape, nup=1x2, turn=false]{Appendices/specs.pdf}</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={203-204}]{thesis.pdf}</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={1-4}]{Appendices/prl.pdf}</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={205-206}]{thesis.pdf}</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={1-4}]{Appendices/pra.pdf}</span><br /><span style="color: rgb(153, 153, 255);">\includepdf[pages={207-220}]{thesis.pdf}</span><br /><br /><span style="color: rgb(153, 153, 255);">\end{document}</span><br /><br />Chunks of my thesis are included (I guess you can spot them), including some landscape pages as a special case. The "turn = false" means that any pdf viewers still display them as portrait. This was important to me, as I want to be able to check they're not going to print upside down! The last two appendices are four pages each and on American letter ("freedom") paper, but that's okay: they'll be scaled for A4. The "specs.pdf" file is 5 pages long and I have included it as 2-up printing on landscape pages which show as portrait in the viewer. Since I needed ensure that they occupy 4 sides of A4 in total, I included 3 blank pages denoted by the empty braces {}. So, the first two-and-a-half sides of A4 have the 5 pages of specs.pdf, and then there are one-and-a-half blank sides following.<br /><br />I compile with pdflatex.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-12178501977734051312010-08-16T15:35:00.003+01:002010-08-16T15:49:58.578+01:00LaTeX: coloured text and blank page fun.I want to insert some research papers into my thesis. These are in separate pdf files which I don't yet know how I will insert. (pdfpages isn't my friend because I'm banned from using pdflatex due to having eps graphics which I can't be bothered to convert.)<br /><br />I'll figure out that bit in a minute, but right now I want to force a blank page (<span style="font-style: italic;">with</span> a header and footer) which will be printed on the reverse of an appendix section page. This has to come before the place where I will insert the pdf pages. Actually, latex adds this page automatically at the moment, because it wants my "Appendix" section pages to be on the right-hand sides of my document. The issue is that if I then start to add to my page counter, the reverse-side blank page has the wrong page number for where it will be printed!<br /><br />Here's my work-around. Each introductory page for an appendix goes like this:<br /><br /><span style="color: rgb(153, 153, 255);">\chapter{An included paper}</span><br /><span style="color: rgb(153, 153, 255);">Following is a copy of an amazing paper from our research group.</span><br /><span style="color: rgb(153, 153, 255);">\newpage</span><br /><span style="color: rgb(153, 153, 255);">\mbox{}</span><br /><br />The mbox ensures the new page actually happens. Then, before the next \include{} in the master file, I add four pages (the research paper length!) to my counter.<br /><br /><span style="color: rgb(153, 153, 255);">\addtocounter{page}{4}</span><br /><br />So far, so awesome. Now I'll fight to include the papers in the file. I'm thinking psutils...<br /><br />OH! I forgot to tell you about coloured text! Before I found the mbox doo-dah I was going to just write "cheese" in white on the blank page. I'd do the following in my preamble:<br /><br /><span style="color: rgb(153, 153, 255);">\usepackage{color}</span><br /><span style="color: rgb(153, 153, 255);">\definecolor{orange}{rgb}{1,0.5,0}</span><br /><br />and then on my "blank" page, I'd do:<br /><br /><span style="color: rgb(153, 153, 255);">\newpage</span><br /><span style="color: rgb(153, 153, 255);">\textcolor{orange}{cheese}</span><br /><br />Ok, that's orange, but you get the picture. You can define white.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-88003134690415868472010-06-07T18:43:00.002+01:002010-06-07T18:48:04.398+01:00Non-coloured hyperrefs in latexSo, I love to leap around my thesis like superman using the "hyperref" package. However, I do not like increased printing costs by having pretty pink references on every page (our printer selects the cheaper b/w printing intelligently). I was colouring my links black using this clunky bit of code:<br /><span style="color: rgb(153, 153, 255);">\hypersetup{</span><br /><span style="color: rgb(153, 153, 255);"> colorlinks,%</span><br /><span style="color: rgb(153, 153, 255);"> citecolor=black,%</span><br /><span style="color: rgb(153, 153, 255);"> filecolor=black,%</span><br /><span style="color: rgb(153, 153, 255);"> linkcolor=black,%</span><br /><span style="color: rgb(153, 153, 255);"> urlcolor=black</span><br /><span style="color: rgb(153, 153, 255);">}</span><br />...but this resulted in the printer choosing to mix colours to achieve black text on pages with a hyperlink! Argh! It looked stupid, it was stupid! Hopefully this more elegant bit of code might fix whatever oddity is occuring:<br /><span style="color: rgb(153, 153, 255);">\hypersetup{pdfborder={0 0 0},colorlinks = false}</span><br />The pdf certainly looks no different... fingers crossed for printing time.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-29226444547935665042010-06-04T15:46:00.002+01:002010-06-04T15:55:34.001+01:00Sidewaystable prints upside downI have two consecutive landscape tables in my thesis using the "sidewaystable" package. The package rotates them so that the top of the table is closest to the spine of the book, however this manifests itself in the pdf as the page headers and footers appearing to the right of one landscape page, and to the left of the next. When I print double sided, one page has a header which is upside down. My preamble is thusly:<br /><br /><span style="color: rgb(153, 153, 255);">\documentclass[a4paper,11pt,twoside]{book}</span><br /><span style="color: rgb(153, 153, 255);">\usepackage{rotating}</span><br /><br />... the solution was to choose:<br /><br /><span style="color: rgb(153, 153, 255);">\usepackage[figuresright]{rotating}</span><br /><br />So that the figures are always in one direction. Now my headers are always to the right of the landscape page. Hopefully this will now force them to be the right-way-up! If they both print upside down, I suppose I must choose [figuresleft] instead. I've no idea if this is just a symptom of my particular combination of pdf reader and printer, but hey-ho.<br /><br />Thanks to the Szwer for solving this one for me.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-39261484820587324862010-03-24T20:25:00.003+00:002010-03-24T20:41:15.481+00:00Breaking URLs in BibTeXHere's a work-around for a sticky problem when citing URLs in LaTeX documents.<br /><br />My problem manifested itself in ugly URLs in my bibliography which did not break over multiple lines, causing underfull hboxes all over the shop: the line of text preceding the URLs had 5 words spread horridly across the page.<br /><br />I tried various work-arounds found via google but the one that eventually solved my problem was found <a href="http://www.scribd.com/doc/6328690/BibTeX-Tips-and-FAQ">here</a> in "BibTeX tips and FAQ" by M. Shell and D. Hoadley.<br /><br />My preamble contains the following:<br /><span style="color: rgb(153, 153, 255);">\usepackage{url}</span><br /><span style="color: rgb(153, 153, 255);">\usepackage[ps2pdf, pagebackref]{hyperref}</span><br /><br />And I cite all my URLs in BibTeX like this:<br /><span style="color: rgb(153, 153, 255);">\url{http://morecakelessfish.blogspot.com/}</span><br /><br />I like to compile into pdf by using dvi2ps then ps2pdf otherwise I seem to have some issues with offset bounding boxes in my pyxplot .eps graphics. Despite calling the url package in my references (see example above), my URLs <span style="font-style: italic;">still</span> weren't breaking. Apparently this is a problem when going via dvi after including the hyperref package. The problem was solved by including <a href="http://www.ctan.org/tex-archive/help/Catalogue/entries/breakurl.html">breakurl.sty</a> AFTER the hyperref package in my preamble thusly:<br /><br /><span style="color: rgb(153, 153, 255);">\usepackage{url}</span><br /><span style="color: rgb(153, 153, 255);"> \usepackage[ps2pdf, pagebackref]{hyperref}</span><br /><span style="color: rgb(153, 153, 255);">\usepackage{breakurl}</span><br /><br />Jobs a good'un.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com1tag:blogger.com,1999:blog-6702157757260886111.post-58786524329746940292009-07-23T17:00:00.003+01:002009-07-23T17:11:32.408+01:00Battles won against my laptopMy 7 year old laptop is now too geriatric to run anything too meaty. Windows is definitely out of the question, so I have Xubuntu.<br />Today, I bring you:<br /><br /><span style="font-weight: bold; color: rgb(153, 153, 255);">How to add a terminal launcher to the xfce panel</span><span style="font-weight: bold; color: rgb(153, 153, 255);">:</span><br />right-click>add new item>launcher<br />Then find the terminal program in /usr/bin/xfce4-terminal and drag it into the launcher. Or, just set command to "<span style="font-style: italic; color: rgb(204, 204, 255);">/usr/bin/xfce4-terminal</span>" and uncheck the "run in terminal" box. Give it a nice name and picture of a terminal window.<br /><br /><br /><span style="font-weight: bold; color: rgb(153, 153, 255);">How to connect to a windows shared area when smb4k is acting up:</span><br />If you can see the various windows computers in smb4k (eg ACOMPUTER) but it won't let you mount ACOMPUTER/afile, then try this on the command line...<br /><div style="text-align: center;"><span style="color: rgb(204, 204, 255); font-style: italic;">sudo mount -t smbfs //ACOMPUTER/afile/ -o username=myname /home/myfile/MyMount/</span><br /></div>...where you have provided your username to access the shared area. When prompted, give the corresponding password.<br />To unmount:<br /><div style="text-align: center;"><span style="font-style: italic; color: rgb(204, 204, 255);">sudo umount /home/myfile/MyMount/</span><br /></div>Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com2tag:blogger.com,1999:blog-6702157757260886111.post-15804929974734146972009-07-17T13:57:00.003+01:002009-07-22T17:10:54.912+01:00Greek letters in InkscapeTo get greek letters, press <span style="color: rgb(204, 204, 255); font-style: italic;">Ctrl+u</span>. You'll see "<span style="color: rgb(153, 153, 255);">Unicode (Enter to finish)</span>" come up in the status bar. Let go of <span style="font-style: italic; color: rgb(204, 204, 255);">Ctrl+u</span> and type in your <a href="http://unicode.org/charts/PDF/U0370.pdf">unicode number</a> followed by the return key.<br /><br />w00.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-15418519543851035872009-07-03T13:29:00.003+01:002009-07-03T13:38:54.904+01:00Formatted Read Statements yet again.Further to my last post, I want to add a code snippet for reading in large arrays with many columns. It has some nice implicit do-loops. "myfile.ans" contains 1 column of integers, followed by Ncols of data that I want to read into "Blam" and Ncols that I want to read into "Dlam".<br /><br /><span style="color: rgb(153, 153, 255);"> integer :: i, Nrows, Ncols</span><br /><span style="color: rgb(153, 153, 255);"> real :: Blam(Nrows, Ncols), Dlam(Nrows, Ncols)</span><br /><span style="color: rgb(153, 153, 255);"> integer :: pixies(Nrows)</span><br /><span style="color: rgb(153, 153, 255);"> character(1) :: tmp</span><br /><br /><span style="color: rgb(153, 153, 255);"> open(unit=2,file='myfile.ans',status='OLD',action='READ')</span><br /><span style="color: rgb(153, 153, 255);"> do i = 1,Nrows,</span><br /><span style="color: rgb(153, 153, 255);"> read(2,20) pixies(i), (tmp,Blam(i,j), j=1,Ncols), (tmp,Dlam(i,j), j=1,Ncols)</span><br /><span style="color: rgb(153, 153, 255);"> enddo</span><br /><span style="color: rgb(153, 153, 255);"> close(2)</span><br /><span style="color: rgb(153, 153, 255);"> 20 format(I3, 36(A1,F6.4))</span><br /><br />Annoyingly, I can't seem to replace 36 (=2*Ncols) with a variable name or my compiler shouts. A mystery for another time I think.Alihttp://www.blogger.com/profile/02072011122363335523noreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-36684722316550097482009-06-22T12:57:00.002+01:002009-06-22T13:04:22.860+01:00Formatted Read Statements again.Grrr. I'm trying to read in a formatted file of integers such as:<br /><span style="color: rgb(153, 153, 255);"> 1 1 1</span><br /><span style="color: rgb(153, 153, 255);"> 10 10 10</span><br /><span style="color: rgb(153, 153, 255);">100 100 100</span><br />(... three characters wide, one space between each column)<br />Fortran is giving me junk unless I format my read statement with<br /><span style="font-style: italic; color: rgb(204, 204, 255);">10 format(I3,A1,I3,A1,I3)</span><br />where I read the single space into a temporary variable declared as:<br /><span style="color: rgb(204, 204, 255); font-style: italic;">character(1) :: tmp</span><br />This is why I am in a bad mood with Fortran today. I put faith in it, and this is how it repays me. Plus, the fridge has frozen my tomatoes. I wonder if they are in league.Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-6702157757260886111.post-51371145363290794502009-06-19T20:15:00.002+01:002009-06-19T20:18:31.613+01:00Compiling modules separatelyWhen I have a module declared in mymodule.f90, I can compile it like so:<br /><div style="text-align: center;"><span style="color: rgb(153, 153, 255);">gfortran -m32 -c mymodule.f90</span><br /></div>... I can also compile the main file this way:<br /><div style="text-align: center;"><span style="color: rgb(153, 153, 255);">gfortran -m32 -c mainfile.f90</span><br /></div>Finally I must link it, possibly also with the NAG library:<br /><div style="text-align: center;"><span style="color: rgb(153, 153, 255);">gfortran -m32 mymodule.o mainfile.o /opt/NAG/fll3a21dfl/lib/libnag_nag.a -o mainfile</span><br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-38719929131995360362009-06-18T14:30:00.004+01:002009-06-18T14:34:31.542+01:00Fortran array initializationThis webpage <a href="http://www.pcc.qub.ac.uk/tec/courses/f77tof90/stu-notes/f90studentMIF_5.html">here</a> is very helpful for fortran arrays.<br /><br />I'd forgotten that you can initialize vectors like this:<br /><div style="text-align: left;"><span style="color: rgb(153, 153, 255);">x = (/(i,i=0,maxx-1)/)</span><br /></div>Instead of:<br /><div style="text-align: left;"><span style="color: rgb(153, 153, 255);">do i=1,maxx</span><br /><span style="color: rgb(153, 153, 255);"> x(i) = i-1</span><br /><span style="color: rgb(153, 153, 255);">enddo</span><br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-20526022892280341012009-05-13T17:47:00.003+01:002009-05-13T18:06:13.280+01:00gcc fails to find header filesBecause I have clearly been neglecting the guts of my gcc installation too much recently (oh happy respite from commandline errors!), my computer decided to throw a wobbly about compiling a C program that included (amongst other friends) io.h, conio.h and dir.h.<br />A simple "hello world" program would compile when including stdio.h but not when I added io.h, screaming:<br /><div style="text-align: center;"><span style="color: rgb(153, 153, 255);">error: io.h: No such file or directory</span><br /></div>I thought gcc would search /usr/include/sys automatically, but it appears not. I have to tell it on the command line:<br /><div style="text-align: center;"><span style="font-style: italic; color: rgb(204, 204, 255);">gcc -o andorsif andorsif.c -I /usr/include/sys -L /usr/include/sys</span><br /></div>After I cleared up that heap of doodoo then I still get errors from the program that look like:<br /><div style="text-align: center;"><span style="color: rgb(153, 153, 255);">error: ‘MAXPATH’ was not declared in this scope</span><br /></div>but replacing incidences of MAXPATH with FILENAME_MAX seems to clear up that one.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-28778459152402476422008-12-10T12:02:00.004+00:002008-12-10T12:25:20.326+00:00Addressing integer bits in FortranI want to find out about 8-bit integers (kind = 1) in gfortran.<br />Apparently they seem to be signed and stored as "<a href="http://en.wikipedia.org/wiki/Signed_number_representations">two's complement</a>". When you give the integer a value, you can view the bits like so:<br /><br /><span style="color: rgb(204, 204, 255);">integer(kind = 1) I</span><br /><span style="color: rgb(204, 204, 255);">integer numbit(8) ! stores the bit values as 0 or 1's</span><br /><br /><span style="color: rgb(204, 204, 255);">I = 5</span><br /><span style="color: rgb(204, 204, 255);">do j= 1,8</span><br /><span style="color: rgb(204, 204, 255);"> numbit(i) = ibits(I,j-1,1)</span><br /><span style="color: rgb(204, 204, 255);">enddo</span><br /><span style="color: rgb(204, 204, 255);">write(*,*) 'bits: ', numbit</span><br /><br />...where here IBITS is extracting 1 bit from I at position j-1 and returning it as an integer with the bit value right-justified and the rest of the bits 0. So "1" at position j-1 is returned by ibits(I,j-1,1) as "00000001" which has integer value 1.<br /><br />Alternatively, I could do this:<br /><br /><span style="color: rgb(204, 204, 255);">integer(kind = 1) I</span><br /><span style="color: rgb(204, 204, 255);"> integer numbit(8) ! stores the bit values as 0 or 1's</span><br /><br /><span style="color: rgb(204, 204, 255);">I = 5</span><br /><span style="color: rgb(204, 204, 255);"> do j= 1,8</span><br /><span style="color: rgb(204, 204, 255);"> numbit(i) = btest(I,j-1)</span><br /><span style="color: rgb(204, 204, 255);"> enddo</span><br /><span style="color: rgb(204, 204, 255);"> write(*,*) 'bits: ', numbit</span><br /><br />...where BTEST returns .true. if the bit in position j-1 is "1", and .false. otherwise. This is implicitly converted to an integer by the gfortran compiler (but not without warnings at compile time), where .true. => 1 and .false. => 0.<br /><br />Both of these return:<br /><span style="color: rgb(153, 153, 255);">bits: 1 0 1 0 0 0 0 0</span><br /><br />I guess the take-home message is that when you write out a bit-string, eg.<br />5 = [0101]<br />then the right-most bit is addressed as bit 0, and in general, bit number 1 is the second bit as you move left, etc.<br /><br />So if you start with all bits set to zero, you can use IBSET to set certain bits to 1 and get whatever number you fancy...<br /><br /><span style="color: rgb(204, 204, 255);">I = 0 ! [00000000]</span><br /><span style="color: rgb(204, 204, 255);">I = ibset(I,0) ! [00000001]</span><br /><span style="color: rgb(204, 204, 255);">I = ibset(I,2) ! [00000101]</span><br /><span style="color: rgb(204, 204, 255);">write(*,*) 'I = ', I</span><br /><br />... and we get <span style="color: rgb(153, 153, 255);">I = 5</span>, as intended.<br /><br />I guess this is a stupid post, but it wasn't obvious to me that the bit string would be numbered from the right starting at index 0. The default index for matrices in Fortran 95 starts at 1. Ho hum.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-41203989319117757962008-12-09T12:04:00.004+00:002008-12-09T12:14:42.891+00:00Incompatible ranks?!Here's a fun problem that I have encountered. It might be a bug, or it might not (I've run out of patience with google-ing it now I have my program working).<br /><br />I have a two dimensional matrix. I sum it down one dimension and then find the position of the maximum entry.<br /><br /><span style="color: rgb(204, 204, 255);">subroutine ionfinder(subframe,x_dim,y_dim, irow, icol)<br /><br /></span><span style="color: rgb(204, 204, 255);"> ! define imputs, and function type itself</span><br /><span style="color: rgb(204, 204, 255);"> integer, intent(in) :: x_dim, y_dim</span><br /><span style="color: rgb(204, 204, 255);"> integer, intent(in) :: subframe(x_dim,y_dim)</span><br /><span style="color: rgb(204, 204, 255);"> integer, intent(out) :: irow, icol(4) !ion positions</span><br /><br /><span style="color: rgb(204, 204, 255);"> ! the code follows...*********************</span><br /><span style="color: rgb(204, 204, 255);"> irow = maxloc(sum(subframe,1))</span><br /><span style="color: rgb(204, 204, 255);"> write(*,*) 'ions in row (y): ', irow<br /><br /></span><span style="color: rgb(204, 204, 255);">end subroutine ionfinder</span><br /><br />...but this causes my compiler (gfortran) to shriek:<br /><br /><span style="color: rgb(153, 153, 255);"> irow = maxloc(sum(subframe,1))</span><br /><span style="color: rgb(153, 153, 255);"> 1</span><br /><span style="color: rgb(153, 153, 255);">Error: Incompatible ranks 0 and 1 in assignment at (1)</span><br /><br />Huuuurrrmmm. Seems a bit silly, but the following kludge fixes things:<br /><br /><span style="color: rgb(204, 204, 255);"> subroutine ionfinder(subframe,x_dim,y_dim, irow, icol)<br /><br /></span><span style="color: rgb(204, 204, 255);"> ! define imputs, and function type itself</span><br /><span style="color: rgb(204, 204, 255);"> integer, intent(in) :: x_dim, y_dim</span><br /><span style="color: rgb(204, 204, 255);"> integer, intent(in) :: subframe(x_dim,y_dim)</span><br /><span style="color: rgb(204, 204, 255);"> integer, intent(out) :: irow, icol(4) !ion positions</span><br /><br /><span style="color: rgb(204, 204, 255);"> ! define other datum within function</span><br /><span style="color: rgb(204, 204, 255);"> integer tmp(1)</span><br /><br /><span style="color: rgb(204, 204, 255);"> ! the code follows...*********************</span><br /><span style="color: rgb(204, 204, 255);"> tmp = maxloc(sum(subframe,1))</span><br /><span style="color: rgb(204, 204, 255);"> irow = tmp(1)</span><br /><span style="color: rgb(204, 204, 255);"> write(*,*) 'ions in row (y): ', irow<br /><br /></span> <span style="color: rgb(204, 204, 255);">end subroutine ionfinder</span><br /><br />Well well well. I should probably investigate the cause further but I'm not going to because I have physics to do, not Fortran to fix.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6702157757260886111.post-43418310712106025762008-09-16T09:58:00.001+01:002008-09-16T10:08:47.972+01:00Formatted Read StatementsThis is not a very exciting problem or solution, but I shall post it anyway.<br />I was trying to read formatted data from a file like this:<br /><br /><span style="color: rgb(153, 153, 255);"> 0 9.99929445e-01</span><br /><span style="color: rgb(153, 153, 255);"> 1 6.46409406e-05</span><br /><span style="color: rgb(153, 153, 255);"> 2 3.80249651e-06</span><br /><span style="color: rgb(153, 153, 255);"> 3 1.03999904e-06</span><br /><span style="color: rgb(153, 153, 255);"> 4 4.24499610e-07</span><br /><span style="color: rgb(153, 153, 255);"> 5 2.23999794e-07</span><br /><br />I first tried the following:<br /><br /><span style="color: rgb(204, 204, 255); font-style: italic;">integer :: myint(5)</span><br /><span style="color: rgb(204, 204, 255); font-style: italic;">real(kind = 10) :: myreal(5)</span><br /><br /><span style="color: rgb(204, 204, 255); font-style: italic;">open(unit=2,file=filepath,status='OLD',action='READ')</span><br /><span style="color: rgb(204, 204, 255); font-style: italic;">do i = 1,5</span><br /><span style="color: rgb(204, 204, 255); font-style: italic;"> read(2,20) myint(i),myreal(i)</span><br /><span style="color: rgb(204, 204, 255); font-style: italic;">end do</span><br /><span style="color: rgb(204, 204, 255); font-style: italic;">close(2)</span><br /><span style="color: rgb(204, 204, 255); font-style: italic;">20 format(I6,E15.8E3)</span><br /><br />The I6 refers to the field width of the integer column. But alas, the output was this:<br /><br /><span style="color: rgb(153, 153, 255);"> 0 0.99992944E+001</span><br /><span style="color: rgb(153, 153, 255);"> 1 0.64640941E+001</span><br /><span style="color: rgb(153, 153, 255);"> 2 0.38024965E+001</span><br /><span style="color: rgb(153, 153, 255);"> 3 0.10399990E+001</span><br /><span style="color: rgb(153, 153, 255);"> 4 0.42449961E+001</span><br /><span style="color: rgb(153, 153, 255);"> 5 0.22399979E+001</span><br /><br />Oddly enough, everything was in order except that it would round powers from e-01 to e-09 up to E+001, and e-10 to e-19 became E+000 etc. Most odd. The solution was to change the format statement to skip the 2 blank spaces between the columns, which I had forgotten to do:<br /><br /><span style="color: rgb(204, 204, 255); font-style: italic;">20 format(I6,2X,E15.8E3)</span><br /><br />Simple really, but I don't know why it gives such a strange behaviour.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-22015456174095528102008-09-08T18:16:00.000+01:002008-09-08T18:43:48.397+01:00Oh Fortran, how I love thee.Fortran's logical operators that operate on integers happen to be bitwise. I didn't care about this until now. Here's a summary for two integers, a and b, which can take values 0 or 1.<br /><br /><span style="font-weight: bold;">logical AND:</span><br /><table border="0" cellspacing="0"><br /><tbody><tr><td style="text-align: center; font-weight: bold;">(ab)</td><td style="text-align: center; font-weight: bold;">iand(a,b)</td></tr><br /><tr><td style="text-align: center;">00</td><td style="text-align: center;">0</td></tr><br /><tr><td style="text-align: center;">01</td><td style="text-align: center;">0</td></tr><br /><tr><td style="text-align: center;">10</td><td style="text-align: center;">0</td></tr><br /><tr><td style="text-align: center;">11</td><td style="text-align: center;">1</td></tr><br /></tbody></table><br /><span style="font-weight: bold;">logical OR:</span><br /><table border="0" cellspacing="0"><br /><tbody><tr><td style="text-align: center; font-weight: bold;">(ab)</td><td style="text-align: center; font-weight: bold;">ior(a,b)</td></tr><br /><tr><td style="text-align: center;">00</td><td style="text-align: center;">0</td></tr><br /><tr><td style="text-align: center;">01</td><td style="text-align: center;">1</td></tr><br /><tr><td style="text-align: center;">10</td><td style="text-align: center;">1</td></tr><br /><tr><td style="text-align: center;">11</td><td style="text-align: center;">1</td></tr><br /></tbody></table><br /><span style="font-weight: bold;">logical XOR:</span><br /><table border="0" cellspacing="0"><br /><tbody><tr><td style="text-align: center; font-weight: bold;">(ab)</td><td style="text-align: center; font-weight: bold;">ieor(a,b)</td></tr><br /><tr><td style="text-align: center;">00</td><td style="text-align: center;">0</td></tr><br /><tr><td style="text-align: center;">01</td><td style="text-align: center;">1</td></tr><br /><tr><td style="text-align: center;">10</td><td style="text-align: center;">1</td></tr><br /><tr><td style="text-align: center;">11</td><td style="text-align: center;">0</td></tr><br /></tbody></table><br /><span style="font-weight: bold;">logical NOT:</span><br /><table border="0" cellspacing="0"><br /><tbody><tr><td style="text-align: center; font-weight: bold;">(a)</td><td style="text-align: center; font-weight: bold;">not(a)</td></tr><br /><tr><td style="text-align: center;">0</td><td style="text-align: center;">-1</td></tr><br /><tr><td style="text-align: center;">1</td><td style="text-align: center;">-2</td></tr><br /></tbody></table><br />WTF? I have been bitten by the bitwise bear! In order to get zeros and ones, I must use <span style="font-style: italic; color: rgb(204, 204, 255);">ieor(1,a)</span> instead of <span style="font-style: italic; color: rgb(204, 204, 255);">not(a)</span>. Pah.<br /><br />Also, the tables in this post look all shit in my browser but I can't be bothered to fix them when I have Fortran to do instead.<br /><br />Today's post was brought to you by the numbers 0 and 1 and the letter F.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6702157757260886111.post-87030603830891151752008-05-19T09:42:00.000+01:002008-05-19T09:49:11.615+01:00Installing an Epson scanner under MandrivaAnother how-to, brought to you by Mr B.:<br /><br />To install and use the Epson Perfection 2480 scanner under Mandriva:<br /><br />1) install "<span style="color: rgb(153, 153, 255);">sane</span>" (in package manager, install "<span style="color: rgb(153, 153, 255);">libsane</span>", "<span style="color: rgb(153, 153, 255);">sane-backends</span>" and perhaps "<span style="color: rgb(153, 153, 255);">sane-frontends</span>").<br /><br />2) login as root, go to <span style="color: rgb(153, 153, 255);">/etc/sane.d/</span> and edit the file "<span style="color: rgb(153, 153, 255);">dll.conf</span>" and ensure the line "<span style="color: rgb(153, 153, 255);">snapscan</span>" is uncommented (without a # at the beginning of the line).<br /><br />3) from the CD supplied with the scanner, find the file "<span style="color: rgb(153, 153, 255);">ESCAN/ModUsd.cab</span>" and copy to your desktop (or elsewhere!).<br /><br />4) go to the directory on your hard drive containing "<span style="color: rgb(153, 153, 255);">ModUsd.cab</span>" and run<br /><br /><div style="text-align: center;"><span style="font-style: italic; color: rgb(204, 204, 255);">$ cabextract ModUsd.cab</span><br /></div><br />cabextract is a program to extract files from a micro$oft .cab format, which I have described in a previous post.<br /><br />5) login as root and copy the firmware file "<span style="color: rgb(153, 153, 255);">Esfw41.bin</span>" to <span style="color: rgb(153, 153, 255);">/etc/sane.d/esfw41.bin</span><br /><br />6) run the following (as root):<br /><br /><div style="text-align: center;"><span style="color: rgb(204, 204, 255); font-style: italic;">$ scanimage -L</span><br /></div><br />...and the scanner should be detected!<br /><br />7) use "Kooka" or "Xscanimage" to use scanner (Xscanimage is from the package "<span style="color: rgb(153, 153, 255);">sane-frontends</span>")Unknownnoreply@blogger.com0