Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs for booktabs lib #443

Merged
merged 5 commits into from
Feb 22, 2024
Merged

Improve docs for booktabs lib #443

merged 5 commits into from
Feb 22, 2024

Conversation

muzimuzhi
Copy link
Collaborator

@muzimuzhi muzimuzhi commented Oct 16, 2023

Main changes

  • add missing booktabs table commands
  • mention all used dimensions defined by booktabs package
  • move documentation of trimming options l/r/lr from booktabs lib section to the (general) hlines and vlines section

WARNING

tabularray.tex is not updated, due to EOL issue previously encountered and discussed in #385 (comment).

Here I have to apply patch

diff --git a/manual.lua b/manual.lua
index 1d6b44e..0abd3a9 100644
--- a/manual.lua
+++ b/manual.lua
@@ -7,7 +7,8 @@ local function ReadFile(input)
     print("Error in reading " .. input)
     return
   end
-  local text = f:read("*all")
+  -- normalize line endings, https://stackoverflow.com/a/20599512
+  local text = f:read("*all"):gsub('\r\n?', '\n')
   f:close()
   return text
 end

to overcome lua error

manual.lua:29: attempt to concatenate a nil value (local 'body')

thrown when executing texlua manual.lua. Even then, a Git warning

warning: in the working copy of 'tabularray.tex', LF will be replaced by CRLF the next time Git touches it

is encountered.

tabularray (and perhaps other open source repos by the same author) need a workflow to allow users on OS's using different EOL characters working together.

@lvjr
Copy link
Owner

lvjr commented Jan 24, 2024

I guess replacing "rb" and "wb" with "r' and "w" will solve eol problem among different operating systems, if we also modify MakeManual function below, adding some \r characters.

local function ReadFile(input)
  local f = io.open(input, "rb")
  if f == nil then
    print("Error in reading " .. input)
    return
  end
  local text = f:read("*all")
  f:close()
  return text
end

local function WriteFile(output, text)
  f = io.open(output, "wb")
  f:write(text)
  f:close()
end

@muzimuzhi
Copy link
Collaborator Author

muzimuzhi commented Feb 21, 2024

I dropped patch to ReadFile() in manual.lua, and added #478 for EOL normalization issue.

@lvjr
Copy link
Owner

lvjr commented Feb 22, 2024

I think we can keep those extra spaces in testfiles/table-010.tex file, because it may be useful in the far future (see #13 and #305).

@muzimuzhi
Copy link
Collaborator Author

I think we can keep those extra spaces in testfiles/table-010.tex file, because it may be useful in the far future (see #13 and #305).

I'm not convinced. That example in table-010.tex tests against #32 specifically. New feature, when added, can be tested with new examples.

% See issue #32
\BEGINTEST{testing \par tokens at the beginning and at the end of cell text}
\begin{tblr}{lll}
\hline
One

I agree that minimal and integrated test examples are both needed in some extent, so feel free to restore changes in table-010.tex if that's the way you prefer.

@lvjr lvjr merged commit 2d4cd2d into lvjr:main Feb 22, 2024
2 checks passed
@muzimuzhi muzimuzhi deleted the docs/booktabs-lib branch February 22, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants