hugetim / nbstata

A Jupyter kernel for Stata built on pystata
https://hugetim.github.io/nbstata/
GNU General Public License v3.0
26 stars 1 forks source link

how to hide stata software information in quarto #49

Open 0825kangkang opened 1 week ago

0825kangkang commented 1 week ago

When I render qmd file in quarto, it always show that stata log and software information. Not sure where is th problem. The tool I am using is vscode and the kernel is nstata. My quarto output format is pdf.

hugetim commented 6 days ago

It sounds like you're talking about the Stata "splash" (like the first output shown in this example)? That should be turned off by default. To be sure you're using nbstata, could you share the full yaml header at the start of your .qmd file?

Are you using an nbstata config file? To check, run the %status magic by putting just that in a Stata code block.

0825kangkang commented 6 days ago

YAML I used before is

title: "Stata testing" format: pdf python: nbstata

But badly I uninstalled and installed nbstata. Now I cannot even run the any stata codes. It always show stata_dir is wrong. I check the path (/Applications/Stata/StataMP.app/Contents/MacOS/StataMP) and it works to open stata in the terminal.

Or the problem came out because my install process is wrong? Could you do a favor to take look at it? Thank you!

hugetim commented 6 days ago

I thought the YAML would be jupyter: nbstata

Otherwise, what would you like me to look at, your nbstata config file? Whatever it is, I'm happy to help.

0825kangkang commented 6 days ago

@hugetim thank you so much for your help. I pasted my config file as below.

[nbstata] stata_dir = /Applications/Stata/StataMP.app/Contents/MacOS/StataMP edition = mp splash = False graph_format = png graph_width = 5.5in graph_height = 4in echo = None missing = .

0825kangkang commented 6 days ago

@hugetim thank you so much for your help. I pasted my config file as below.

[nbstata] stata_dir = /Applications/Stata/StataMP.app/Contents/MacOS/StataMP edition = mp splash = False graph_format = png graph_width = 5.5in graph_height = 4in echo = None missing = .

I incorrectly closed this issue. Could you help to reopen it as it is not solved? Thank you :)

hugetim commented 5 days ago

My first thought: Have checked if it works without a config file? You could just move that one to a different directory temporarily.

hugetim commented 5 days ago

Otherwise, maybe try shortening the path to just /Applications/Stata/StataMP.app. I think that's what it's looking for.

0825kangkang commented 5 days ago

It is feasible in the first way. I move the config file to other folder and it works. In the second way it still shows the same error.

But the splash still existing in the pdf file. I pasted my code as below and I also pasted the first page in my pdf (just kick out my licence inforamtion). Thank you!

--- title: "Stata testing" format: pdf jupyter: nbstata ---

```{stata}

sysuse auto summarize

```

Screenshot 2024-09-19 at 08 50 05 Screenshot 2024-09-19 at 08 50 13

hugetim commented 5 days ago

To get the config file working, try re-running the install program with the --conf-file option: https://hugetim.github.io/nbstata/user_guide.html#install-nbstata

That should create a working config file for you, which you can then edit as needed.

But the splash remains puzzling. Can you provide more details about how you produced that screen shot? If possible, attach the full .qmd file, provide the nbstata and quarto versions you're using, and show the quarto command you use to create the output (or explain what you did if you are using VSCode or RStudio to produce the output).

0825kangkang commented 4 days ago

-Below are all contents in my qmd file, no extra codes are used to produce output in vscode. After input below things, there is a 'preview' buttom in vscode and then PDF file is created.

--- title: "Stata testing" format: pdf jupyter: nbstata ---

```{stata}

sysuse auto summarize ```

test.qmd.zip

hugetim commented 4 days ago

Have you tried the %status magic I suggested above to check that the config file you think is being used is actually the operative one? Try putting it by itself in a code block like this, and then see what the output is:

```{stata} %status ```

Otherwise, when I get a chance, I'll see if I can replicate the splash issue using VSCode (albeit on Windows), following your steps. I take it you're using the Quarto Extension for VSCode?

0825kangkang commented 4 days ago

Yes, I am using quarto extension for VScode. But you still need to install quarto first and then for vscode install the extension.

I tried below code and it works as long as I remove the config file to other folders.

```{stata} %status ```

However, the splash is still existing. It seems the config file does not work in my side.