Question

For a gcc cheatsheet I'm writing, I want to create a table which should describe how gcc interprets different file endings. The table I created so far is defined as follows:

|======================================================================
|.c    |C source code which must be preprocessed.
|.i    |C source code which should not be preprocessed.
|.h    |C header file to be turned into a precompiled header.
|.s    |Assembler code.
|other |
An object file to be fed straight into linking. Any file name with no
recognized suffix is treated this way.
|======================================================================

The problem I have is that the table spans the total page width, but what I want is that each column only is as wide as it's widest entry, and that the table will span only as much witdh as it needs.

Was it helpful?

Solution

In general, it's not a good idea to mix content and layout rules within the source file.

That is for a good reason: The layout definition of the table depends on the output format. If you use for example html as backend for the document, css would be an appropriate technology to layout the document. On the other hand, e.g. if you use a formatting objects processor to create pdf files like apache fop, automatic table-layout is not supported by all FO processors.

To answer your question: It depends on the output format, how the table layout will be defined correctly. A definition within the AsciiDoc markup is the wrong way in most cases.

OTHER TIPS

It might make more sense to use a horizontal list in this case rather than a table. The rendered result is close to what you are looking for. The syntax would look like the following:

[horizontal]
+.c+:: C source code which must be preprocessed.
+.i+:: C source code which should not be preprocessed.
+.h+:: C header file to be turned into a precompiled header.
+.s+:: Assembler code.
other:: An object file to be fed straight into linking. Any file name with no recognized suffix is treated this way.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top