diff --git a/compiler/literate/html.ml b/compiler/literate/html.ml
index 64483fd7..82e3859c 100644
--- a/compiler/literate/html.ml
+++ b/compiler/literate/html.ml
@@ -140,7 +140,7 @@ let rec law_structure_to_html
let t = pre_html t in
if t = "" then () else Format.fprintf fmt "
%s
" t
| A.CodeBlock (_, c, metadata) when not print_only_law ->
- let start_line = Pos.get_start_line (Mark.get c) - 1 in
+ let start_line = Pos.get_start_line (Mark.get c) + 1 in
let filename = Pos.get_file (Mark.get c) in
let block_content = Mark.remove c in
check_exceeding_lines start_line filename block_content;
diff --git a/compiler/literate/latex.ml b/compiler/literate/latex.ml
index 390ef7f1..b25dc972 100644
--- a/compiler/literate/latex.ml
+++ b/compiler/literate/latex.ml
@@ -34,7 +34,7 @@ let update_lines_of_code c =
- Pos.get_start_line (Mark.get c)
- 1
-(** Espaces various LaTeX-sensitive characters *)
+(** Escapes various LaTeX-sensitive characters *)
let pre_latexify (s : string) : string =
(* Then we send to pandoc, to ensure the markdown features used in the
original document are correctly printed! *)
@@ -296,7 +296,7 @@ let rec law_structure_to_latex
(pre_latexify (Mark.remove al)))
| A.LawText t -> Format.fprintf fmt "%s" (pre_latexify t)
| A.CodeBlock (_, c, false) when not print_only_law ->
- let start_line = Pos.get_start_line (Mark.get c) - 1 in
+ let start_line = Pos.get_start_line (Mark.get c) + 1 in
let filename = Pos.get_file (Mark.get c) in
let block_content = Mark.remove c in
check_exceeding_lines start_line filename block_content;
diff --git a/compiler/literate/literate_common.ml b/compiler/literate/literate_common.ml
index 12c826ef..72fd3a33 100644
--- a/compiler/literate/literate_common.ml
+++ b/compiler/literate/literate_common.ml
@@ -113,13 +113,10 @@ let check_exceeding_lines
Uutf.String.fold_utf_8 (fun (acc : int) _ _ -> acc + 1) 0 s
in
if len_s > max_len then
- Message.emit_warning
- "@[The line @{%d@} in @{%s@} is \
- exceeding @{%s@}@]"
- (start_line + i + 1)
- filename max_len (String.sub s 0 max_len)
- (String.sub s max_len (len_s - max_len)))
+ Message.emit_spanned_warning
+ (Pos.from_info filename (start_line + i) (max_len + 1)
+ (start_line + i) (len_s + 1))
+ "This line is exceeding @{%d@} characters" max_len)
let with_pygmentize_lexer lang f =
let lexer_py =