Exporting Julia code as HTML or PDF

4 Likes

The expected outcome is to write a pdf file with the .jl file in it.

/ = not a unary operator
//= not a unary operator
\ = invalid escape sequence

You need to copy and paste exactly what you are writing in Julia and exactly what Julia “replies”. Put everything inside triple backticks at the beginning and end.

1 Like

Yes, we (I and the others who are trying to help you) got that. The title you provided for the topic was a good one, and makes it clear what you want to achieve. But you haven’t explained enough for us to understand why it isn’t working for you.

I think one of the problems is that you haven’t learned to quote code. If you wrap code, and Julia output in sets of triple backticks, like this:

```
This text won't be formatted, and is displayed exactly
the way I type it.
```

we will get a better picture of what you tried and what the result was.

So lets take a look at what I think isn’t working for you:

Based on this, I think you need to read the Weave.jl documentation more carefully.

  1. The first argument to weave should be a string that represents the source file not a directory.
  2. The out_path argument should be a string that represents a directory, not a file. The directory must exist before you run weave. Note that you can also use the special symbol :doc for this argument, so that the output lands in the same directory as the input.

What you should have used is

weave("C:/Users/brett/OneDrive/Documents/ECON214Assignment3.jl", out_path="C:/Users/brett/OneDrive/Documents", doctype="md2pdf")

I hope this helps.

2 Likes
weave("C:/Users/brett/OneDrive/Documents/", ECON214Assignment3.jl, out_path=C:/Users/brett/OneDrive/Documents/ECON214Assignment3.pdf, doctype="md2pdf")

the file I’m trying to weave is Econ214Assignment3.jl
the pdf I want is to be called Econ214Assignment3.pdf

It would be much more helpful if you could post error messages more. But more importantly, you it would be best for you to read the error messages. For instance, in your out_path, above, you haven’t quoted your strings, which is probably going to give you an error.

2 Likes