Skip to content

pandoc to latex forces line rewrap (does not respect linebreaks) #1701

Closed
aswolf opened this Issue · 4 comments

4 participants

@aswolf

It appears that when pandoc is used to convert from a markdown file to latex, it does not respect the line breaks in the markdown file. Rather than maintaining the line definitions, it automatically rewraps each paragraph such that each line is less than 80 characters.

For many latex users, this is totally undesirable behavior. Writing with one sentence per line is common practice as it simplifies output from diff'ing files and is better for version controlled tex files.

Is it possible to change the behavior so that it respects the lines as defined in the original markdown file? This would afford a huge advantage to latex users, allowing them to write initial drafts in markdown, which is much quicker, and then converting to latex for further work. If this isn't the desired default behavior for other reasons, is it possible to add an optional flag?

Thanks so much!

@jgm
Owner
@aswolf

This would certainly be a welcome change! I have been using markdown more and more in the last few weeks and I really appreciate the greater simplicity relative to latex. I just worry about getting locked into something that isn't quite feature rich enough for manuscript submission. So I want to know that at the end of the day, it produces a latex file that is sensible that can be manually edited if need be. Better of course if any manual latex editing can be avoided!

It is also useful in application to ipython notebooks, since they rely on pandoc to convert to latex. And thus everyone using notebooks as a starting point for projects would be able to recover sensible kernels for integration into a manuscript.

Is this a change that you or someone else is willing and able to make? Unfortunately, it is certainly beyond me having no familiarity with the code and no knowledge of Haskell. But I imagine many would appreciate this option.

@msprev

+1 for a Softbreak element. I use pandoc to manipulate markdown (reading markdown, transforming ast, writing markdown). This is handy for doing operations on elements (moving/changing lists/sections/etc). The main problem I run into is that it destroys the soft linebreaks along the way.

@jgm jgm added a commit to jgm/pandoc-types that referenced this issue
@jgm Added a SoftBreak Inline element.
See jgm/pandoc#1701.

Substantial changes in pandoc are still needed.
67d733e
@jgm
Owner

I'm working on this now in the softbreak branch.

@jgm jgm added a commit that closed this issue
@jgm Implemented SoftBreak and new `--wrap` option.
Added threefold wrapping option.

* Command line option: deprecated `--no-wrap`, added
  `--wrap=[auto|none|preserve]`
* Added WrapOption, exported from Text.Pandoc.Options
* Changed type of writerWrapText in WriterOptions from
  Bool to WrapOption.
* Modified Text.Pandoc.Shared functions for SoftBreak.
* Supported SoftBreak in writers.
* Updated tests.
* Updated README.

Closes #1701.
536b6bf
@jgm jgm closed this in 536b6bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.