COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Gfortran spacing

• Email
• Follow

Hello,

I am used to the lahey fortran compiler..... recently I have switched
to the gfortran compiler.... now when I write out data the default
puts several spaces between variables in the outputted text file....
for example if I do: write (11,*) Data(:)
the text file will have several spaces between the Data variables in
the file 11.... In lahey the default was set to 2 I think... how do i
change this to 2 in gfortran?

Regards,

John Hickey

 0

See related articles to this posting

On Feb 2, 8:26=A0pm, JohnHickey <hickeyj...@gmail.com> wrote:
> Hello,
>
> I am used to the lahey fortran compiler..... recently I have switched
> to the gfortran compiler.... now when I write out data the default
> puts several spaces between variables in the outputted text file....
> for example if I do: write (11,*) Data(:)
> the text file will have several spaces between the Data variables in
> the file 11.... In lahey the default was set to 2 I think... how do i
> change this to 2 in gfortran?
>
> Regards,
>
> John Hickey

You change it by using an explicit format, for example

write (11,"(1000(f0.4,1x)") Data(:)

assuming Data(:) is real.

The free g95 compiler uses fewer spaces in list-directed output. You
could try it.


 0

JohnHickey <hickeyjohn@gmail.com> wrote:

> I am used to the lahey fortran compiler..... recently I have switched
> to the gfortran compiler.... now when I write out data the default
> puts several spaces between variables in the outputted text file....
> for example if I do: write (11,*) Data(:)
> the text file will have several spaces between the Data variables in
> the file 11.... In lahey the default was set to 2 I think... how do i
> change this to 2 in gfortran?

Variants of this count as a frequently asked question here. The specific
question varies, but the general theme is asking how to control
list-directed output formatting.

The answer is invariably to not use list-directed formatting when you

The whole point of list-directed formatting is to make things simple by
not bothering to specify detaults, but to let the compiler put out the
data in whatever way it wants. (Well, not quite whatever way; there are
some specifications in the standard, but the compiler is still left a
lot of liberty).

If you want to specify the formatting details, that's what explicit
formats are for. Yes, that is often more awkward than list-directed.

No, there do not tend to be ways for you to control the details of
list-directed formatting. I have commented several times that the
user-defined output feature of f2003 could trivially be enhanced to
allow this, but there doesn't seem to be much general interest in such
an enhancement. Heck, there doesn't seem to be much rush to implement
even the feature as it is in the f2003 standard. It is one of the last
f2003 features in terms of implementation progress.

P.S. Well, in theory there are ways to control such things in gfortran.
It being open source, you could change it yourself, but I'm going to go
out on a limb and guess that's not what you had in mind. (I'm feeling
pretty steady on that limb. :-)

--
Richard Maine                    | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle           |  -- Mark Twain

 0

On Feb 2, 9:27=A0pm, nos...@see.signature (Richard Maine) wrote:

> No, there do not tend to be ways for you to control the details of
> list-directed formatting.

True, but in g95 one can set the G95_LIST_SEPARATOR variable, which is
the

"string Separator to use when writing list output. May contain any
number of spaces and at most one comma. Default is a single space."

http://g95.org/docs.shtml

 0
Reply beliavsky (2211) 2/3/2011 1:39:54 PM

On 02/03/2011 02:39 PM, Beliavsky wrote:
> On Feb 2, 9:27 pm, nos...@see.signature (Richard Maine) wrote:
>> No, there do not tend to be ways for you to control the details of
>> list-directed formatting.
>
> True, but in g95 one can set the G95_LIST_SEPARATOR variable, which is
> the "string Separator to use when writing list output. May contain any
> number of spaces and at most one comma. Default is a single space."

Which also does not really toggle between the two design choices:

One group of compilers adds many spaces such that when writing multiple
lines, a nice grid is created and numbers belonging to each other are
underneath each other.

The other group adds just a single space and avoids filling the space
with useless spaces; typically that a good choice if one wants to print
only a single line.

There is an additional design choice: Whether a line break should happen
automatically such that no line is longer than a certain number of
characters or whether one simply writes in one line as long there is
still data left in the IO transfer statement.

I think there are good reasons for those 4 combinations. Usually, I
would like to have a different result at different places in my program
- without tweaking the edit descriptor.

At least "g0" is a convenient edit descriptors which usually gives the
desired result without requiring the user to think too much. :-)

Tobias

PS: There are more choices in list-directed I/O, e.g. how many digits
should be printed, but I think the two mentioned above are the most visible.

 0
Reply burnus (564) 2/3/2011 2:31:51 PM

On 02/03/2011 06:31 AM, Tobias Burnus wrote:
> On 02/03/2011 02:39 PM, Beliavsky wrote:
>> On Feb 2, 9:27 pm, nos...@see.signature (Richard Maine) wrote:
>>> No, there do not tend to be ways for you to control the details of
>>> list-directed formatting.
>>
>
> At least "g0" is a convenient edit descriptors which usually gives the
> desired result without requiring the user to think too much. :-)
>
> Tobias
>
> PS: There are more choices in list-directed I/O, e.g. how many digits
> should be printed, but I think the two mentioned above are the most
> visible.

I though only the i, f, b, o, and z edit descriptors could have zero width?


 0
Reply baf (63) 2/3/2011 4:52:38 PM

On 2/3/11 10:52 AM, baf wrote:
> On 02/03/2011 06:31 AM, Tobias Burnus wrote:
>> On 02/03/2011 02:39 PM, Beliavsky wrote:
>>> On Feb 2, 9:27 pm, nos...@see.signature (Richard Maine) wrote:
>>>> No, there do not tend to be ways for you to control the details of
>>>> list-directed formatting.
>>>
>>
>> At least "g0" is a convenient edit descriptors which usually gives the
>> desired result without requiring the user to think too much. :-)
>>
>> Tobias
>>
>> PS: There are more choices in list-directed I/O, e.g. how many digits
>> should be printed, but I think the two mentioned above are the most
>> visible.
>
> I though only the i, f, b, o, and z edit descriptors could have zero width?
>
>
True for Fortran 2003, Fortran 2008 also allows zero width for G.

Dick Hendrickson

 0
Reply dick.hendrickson (1286) 2/3/2011 5:19:29 PM

On 02/03/2011 05:52 PM, baf wrote:
> I though only the i, f, b, o, and z edit descriptors could have zero width?

It was added with Fortran 2008. I tend to forget that it was a 2008 and
not a 2003 addition as gfortran supports it since GCC 4.4 (i.e. since
more than 2 years). [1]

Thus, if one restricts oneself to gfortran and Cray [2], one can already
use g0. Otherwise, it might be better to restrict oneself to the other
edit descriptors.

Tobias,
who is looking forward to see compilers with full - well-tested -
Fortran 2003 (and possibly also Fortran 2008) support.

[1] http://fortranwiki.org/fortran/show/Fortran+2008+status

 0
Reply burnus (564) 2/3/2011 5:25:18 PM

"JohnHickey" <hickeyjohn@gmail.com> wrote in message
| Hello,
|
| I am used to the lahey fortran compiler..... recently I have switched
| to the gfortran compiler.... now when I write out data the default
| puts several spaces between variables in the outputted text file....
| for example if I do: write (11,*) Data(:)
| the text file will have several spaces between the Data variables in
| the file 11.... In lahey the default was set to 2 I think... how do i
| change this to 2 in gfortran?

With * as the format, the compiler can use any layout that it likes.

If you want specific layout, best to use an explicit format.
That way you can control the position of spaces and how many of them.


 0

8 Replies
236 Views

Similar Articles

12/6/2013 1:15:03 PM
[PageSpeed]

Similar Artilces:

spacing for Jr.
F=F6hren Presentations Beyond Limitations Conquer your Desk= top www.fiehr.de www.indeview.org www.kde.org I don't see why latex should treat Mr. and Jr. differently except that an M is larger than a J. If you have a comma before Jr. you should have a comma after Jr. and that would take care of your problem: give thanks to John Smith, Jr., for his help. Inserting a slash between the dot and the space that follows it should do something for the spacing: give thanks to J.\ Smith, Jr., for his help. Daniel Daniel Winkelmann wrote: >> I don't see why latex should treat Mr. and Jr. differently except >> that an M is larger than a J. >> >> If you have a comma before Jr. you should have a comma after Jr. and >> that would take care of your problem: give thanks to John Smith, >> Jr., for his help. >> >> Inserting a slash between the dot and the space that follows it >> should do something for the spacing: give thanks to J.\ Smith, Jr., >> for his help. How about J.~Smith, Jr\@. for his help -- if you don't want the comma. Or even J.~Smith,~Jr., for his help. \@ cancels

line spacing

spacing in article
I am using the article documentclass to write a simple article. I think the generated PDF file looks not compact enough. How can I reduce those line spaces, such as the space between the lines of title and author, the one between author and date, the one between date and text, etc. ? Thank you -Kevin kevinwat@gmail.com wrote: > I am using the article documentclass to write a simple article. > I think the generated PDF file looks not compact enough. > How can I reduce those line spaces, such as the space > between the lines of title and author, the one between author > and da

Spacing when printing?
Is there someway to always use 8 or 12 chars as spacing with printing to screen so I get: 1 1100 100 instead of: 1 1100 100 ? On Tue, 13 Nov 2007 00:05:20 +0100, saneman <yyyy@dd.com> wrote, quoted or indirectly quoted someone who said : >Is there someway to always use 8 or 12 chars as spacing with printing to >screen so I get: Java normally uses variable pitch fonts, so alignment with spaces does not work. Instead you use right alignment widgets or custom widgets where you place things to the pixel. -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com saneman wrote: > Is there someway to always use 8 or 12 chars as spacing with printing to > screen so I get: > > 1 > 1100 > 100 > > instead of: > > 1 > 1100 > 100 > > ? int x = 1; System.out.printf("Num: %8d...\n",1).flush(); System.out.printf("Num: %8d...\n",100).flush(); prints Num: 1... Num: 100... See <http://java.sun.com/javase/6/docs/api/java/util/Formatter.html#syntax> for more information. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald

Getting rid of double spacing
Hi Guys, is there a way to get rid of double spaces within a string without using the tokenizer method? I was thinking of doing a loop that goes on while two spaces are next to each other within which I'd delete the character it's up to. How do I delete a char? Thanks to all for any ideas/help you might provide. "Bella_Maria" <mbychkova@wmac.com.au> schreef in bericht news:7b749c4e3e3a44cca33e9712b6062ed0@localhost.talkaboutprogramming.com... > Hi Guys, is there a way to get rid of double spaces within a string without > using the tokenizer method? I was think

Vertical spacing between marginpars
Hi group, I'm using a tweaked version of the "fixme" package for placing \marginpar's, indicating text positions that I need to reconsider later on. Now, some lines contain more than one marker, resulting in multiple marginpar boxes on the same height. They stack nicely, but there's quite some vertical whitespace between them. How can I reduce that vertical space? I know about \marginparsep, but that's clearly not the thing to adjust... Thanks in advance, wwwald wwwald wrote: > Hi group, > > I'm using a tweaked version of the "fixme" p

enumerate in table
I'm trying to adjust spacing when using an enumerate environment inside a table (using the booktabs package). I'm using the enumitem package to adjust spacings easily. A minimal working example that illustrates my problem is: \documentclass[10pt]{article} \usepackage{array} \usepackage{booktabs} \usepackage{enumitem} \newenvironment{myenum}% {\begin{enumerate}[topsep=0in,parsep=0in,partopsep=0in,itemsep=0in,% leftmargin=2\tabcolsep]}% {\end{enumerate}} \begin{document} \begin{table} \begin{center} \begin{tabular}{lp{1.0in}} \toprule Col header 1 & Col header 2 \\ \midrule Entry & \begin{myenum} \item Item 1 \item Item 2 \end{myenum} \\ \bottomrule \end{tabular} \end{center} \end{table} \end{document} The two items are set below the first line of the preceding column, but I want them to be aligned with it. How do I do this? Thanks, Nut Le Sun, 15 Aug 2010 07:26:26 -0700 (PDT), nut <nutsenf@gmail.com> a écrit : Hi, > I'm trying to adjust spacing when using an enumerate environment > inside a table (using the booktabs package

mathpazo spacing problems
Hello to all, I've been having problems with spacing with the mathpazo package. Specifically, on page 1 of an article (the page number being at the bottom of the page), the paragraph sometimes goes over the page number. Of course there are brutal ways to break the paragraph - \newpage, for example - but this is quite unpleasant, being completely opposite in spirit to what TeX is intended to be.... Has anyone noticed this kind of behaviour with mathpazo? Any suggestions? Thanks in advance, Yannis ypapageorgiou@gmail.com wrote: > Hello to all, > > I've been having problems with spacing with the mathpazo package. > Specifically, on page 1 of an article (the page number being at the > bottom of the page), the paragraph sometimes goes over the page > number. Of course there are brutal ways to break the paragraph - > \newpage, for example - but this is quite unpleasant, being completely > opposite in spirit to what TeX is intended to be.... > > Has anyone noticed this kind of behaviour with mathpazo? Not here. > Any suggestions? Post a minimal example. I'm by no means an export, but I'm pretty sure that this is not a problem

extend character spacing in bdf font
Hello, I converted tahoma.ttf using shell command: otf2bdf -m iso8859.5 -p 12 -r 72 -o noexcltahoma1272.bdf tahoma.ttf however, most of the characters are glued together when text is shown. For instance "nm" "gh" "ab" do not have a space in between. When generating big sizes like 24pt spacing is OK. How should I edit the bdf-file to put some extra space in? I played with SPACING, SWIDTH, DWITH and even BBX. But there is no difference in the font shown. ************** example: STARTCHAR 0021 ENCODING 33 SWIDTH 416 0 DWIDTH 4 0 BBX 2 9 1 0 BITMAP 80 80 80 80 80 80 80 00 80 ENDCHAR *************************** File starts with these settings: STARTFONT 2.1 COMMENT COMMENT Converted from OpenType font "tahoma.ttf" by "otf2bdf 3.0". COMMENT FONT -FreeType-Tahoma-Medium-R-Normal--12-120-72-72-P-63-ISO8859-5 SIZE 12 72 72 FONTBOUNDINGBOX 12 14 -1 -2 STARTPROPERTIES 19 FOUNDRY "FreeType" FAMILY_NAME "Tahoma" WEIGHT_NAME "Medium" SLANT "R" SETWIDTH_NAME "Normal" ADD_STYLE_NAME "" PIXEL_SIZE 12 POINT_SIZE 120 RESOLUTION_X 72 RESOLUTION_Y 72 SPACING "P" AVERAGE_WIDTH

Leopard Finder windows, icon view, and grid spacing
I don't know if anyone has mentioned this yet, but in Leopard, Finder windows set to icon view now allow you to set the grid spacing. I hadn't noticed this until last night. -- <http://designsbymike.info/shop/mac.cgi> Mac and geek T-shirts & gifts <http://designsbymike.info/shop/musings.cgi> Muckraking T-shirts <http://designsbymike.info/shop/prius.cgi> Prius shirts/bumper stickers <http://designsbymike.info/shop/dance.cgi> Ballroom dance shirts & gifts In article <1i7ex9q.1grx69xm6kmxvN%mikePOST@TOGROUPmacconsult.com>, mikePOST@TOGROUPmacconsult.com (Mike Rosenberg) wrote: > I don't know if anyone has mentioned this yet, but in Leopard, Finder > windows set to icon view now allow you to set the grid spacing. I > hadn't noticed this until last night. It's been mentioned a number of times, actually. -- Support the troops: Bring them home ASAP. In article <1i7ex9q.1grx69xm6kmxvN%mikePOST@TOGROUPmacconsult.com>, mikePOST@TOGROUPmacconsult.com (Mike Rosenberg) wrote: > I don't know if anyone has mentioned this yet, but in Leopard, Finder > windows set to icon view now allow you to set