Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • putpdf: how to minimize space between table rows?

    Dear All,

    this question is similar, but not exactly the same as the one discussed earlier in this forum.

    Consider the following code, which produces the table shown in the screenshot below. I am looking for the way to regulate the spacing between the rows (specifically reduce to fit larger tables).

    Thank you, Sergiy Radyakin

    Code:
    clear all
    
    sysuse auto
    putpdf clear
    putpdf begin, font("Arial",10)
    putpdf paragraph, spacing(line, 1 pt)
    putpdf text ("Table 1"), bold
    
    table rep78 foreign
    collect
    putpdf collect
    putpdf save "tabletest.pdf", replace
    
    // end of file

    Click image for larger version

Name:	car_table.png
Views:	1
Size:	17.5 KB
ID:	1773003


  • #2
    It appears that putpdf table has a non-zero default cell margin.

    Since you are using collect to build and publish your table, you can use collect style cell option margin() to set any and all cell margins to zero.

    Here is your example code, with my edit in blue.
    Code:
    clear all
    
    sysuse auto
    putpdf clear
    putpdf begin, font("Arial",10)
    putpdf paragraph, spacing(line, 1 pt)
    putpdf text ("Table 1"), bold
    
    table rep78 foreign
    collect
    collect style cell, margin(all, width(0))
    putpdf collect
    putpdf save "jj.pdf", replace
    Here is screenshot comparing the two PDF files, the original in back, zero-margin in the front.


    Click image for larger version

Name:	Screenshot 2025-02-18 at 10.48.35 AM.png
Views:	1
Size:	27.3 KB
ID:	1773007

    Comment


    • #3
      Thank you very much Jeff Pitblado (StataCorp)!
      Your advice has worked (and will save quite a bit of pages)!
      Best, Sergiy

      Comment

      Working...
      X