Thứ Bảy, 16 tháng 5, 2026

Font NomNaTong code hexadecimal link tới từ điển


\documentclass[17pt]{extarticle}
\usepackage{fontspec}
\setmainfont{NomNaTong-Regular}
% Khai báo font NomNaTong
\newfontfamily\nomfont{NomNaTong-Regular}
\newcommand{\nom}[1]{{\nomfont\symbol{#1}}}
\usepackage{luacode}
\usepackage{longtable,array,xcolor,listings}

% Sử dụng hyperref để tạo liên kết (ẩn khung màu đỏ quanh link cho đẹp)
\usepackage[hidelinks,unicode]{hyperref}
\usepackage[left=1cm]{geometry} 

\begin{luacode*} 
function print_glyphs(maxCols, maxChars) 
  local id = font.current()
  local fnt = font.getfont(id)
  local a = {}
  
  for k, v in pairs(fnt.characters) do
    a[#a + 1] = k
  end
  table.sort(a)
  
  local col = 1
  for i, k in ipairs(a) do
    if i > maxChars then break end
    
    -- Tạo chuỗi Hex viết hoa phục vụ hiển thị và lệnh \char
    local hex_upper = string.format("%04X", k)
    -- Tạo chuỗi Hex viết thường phục vụ liên kết URL
    local hex_lower = string.format("%04x", k)
    
    -- Đường dẫn URL hoàn chỉnh
    local url = "http://www.nomfoundation.org/common/nom_details.php?codepoint=" .. hex_lower .. "&img=1&uiLang=vn"

    -- In mã Hexadecimal định danh đầu dòng
    if col == 1 then
      tex.sprint(hex_upper) 
      tex.sprint("&") 
    end

    -- Bọc toàn bộ bảng phụ trong lệnh \href để cả mã và chữ Nôm đều click được
    tex.sprint(string.format([[\href{%s}{\begin{tabular}{@{}c@{}} \tiny %s \\ {\nomfont\char"%s} \end{tabular}}]], url, hex_upper, hex_upper))

    if col == maxCols then
      tex.sprint([[\\\hline ]])
      col = 1
    else
      tex.sprint("&")
      col = col + 1
    end
  end
end
\end{luacode*}

\begin{document}

\color{black!20}

\begin{longtable}{>{\color{black!50}\ttfamily\footnotesize}r|
                  *{10}{>{\color{black}\centering\arraybackslash}p{2.2em}|}}
\cline{2-11}
\endhead

\directlua{print_glyphs(10,65463)} \\ \cline{2-11}
\end{longtable}

\end{document}

Thứ Năm, 14 tháng 5, 2026

Font NomNaTong link tới Từ điển


\documentclass[17pt]{extarticle}
\usepackage{fontspec}
\setmainfont{NomNaTong-Regular}
\usepackage{luacode}
\usepackage{longtable,array,xcolor,listings}
\usepackage{hyperref}
\begin{luacode*} 
function print_glyphs(maxCols,maxChars) 
  local id = font.current()
  local fnt = font.getfont(id)
  local col = 1
  local maxU4 = 15*(16^3+16^2+16+1)
  a = {}
  for k, v in pairs(fnt.characters) do
    a [#a + 1] = k
  end
  table.sort(a)
  for i, k in ipairs(a) do
    if i >= maxChars then break end
    if col == 1 then
      if k > maxU4 then
        tex.sprint(string.format("U+%06x", k))
      else
        tex.sprint(string.format("U+%04x", k))
      end
      tex.sprint("&") 
    end
    
    -- Chỉnh sửa tại đây: Sử dụng \href để tạo link
    local url = string.format("https://nomfoundation.org/common/nom_details.php?codepoint=%x&img=1&uiLang=vn", k)
    tex.sprint(string.format([[\href{%s}{\char%i}]], url, k))

    if col == maxCols then
      tex.sprint([[\\\cline{2-]] .. maxCols+1 .. "} ")
      col = 1
    else
      tex.sprint("&")
      col = col + 1
    end
  end
end
\end{luacode*}


\begin{document}

\color{black!20}

\begin{longtable}{>{\color{black!50}\ttfamily\footnotesize}r|
                  *{10}{>{\color{black}}p{1.5em}|}}
\cline{2-11}
\endhead


\directlua{print_glyphs(10,65463)} \\ \cline{2-11}
\end{longtable}

\end{document}  
  

Thứ Tư, 29 tháng 4, 2026

TRAO ĐỔI VÀ TRẢ LỜI THẮC MẮC CỦA ĐỘC GIẢ

Các bạn thân mến,

Trên trang này Thầy Sơn sẽ trao đổi và trả lời các thắc mắc của các bạn trong quá trình sử dụng quyển sách ÔN THI HSG MTCT cấp THCS.
Để đặt câu hỏi các bạn viết vào phần bình luận ở dưới. Nếu câu hỏi phức tạp có thể chụp hình rồi gửi ảnh lên.






Thứ Tư, 30 tháng 7, 2025

AI ĐÂU TRỞ LẠI MÙA THU TRƯỚC



Blog này một thời gian dài bị bỏ quên, nhưng đồng thời tác giả của nó cũng đã quên đi nhiều thứ trong đời. Vì vậy nó được hồi sinh để ghi lại nhưng điều nên nhớ như của một người bị bệnh memento mà muốn lưu giữ lại tất cả.


You left me and went on your way.
I thought I should mourn for you and set your solitary image in my heart wrought in a golden song.
But ah, my evil fortune, time is short.
Youth wanes year after year; the spring days are fugitive; the frail flowers die for nothing, and the wise man warns me that life is but a dewdrop on the lotus leaf.
Should I neglect all this to gaze after one who has turned her back on me?
That would be rude and foolish, for time is short.
Then, come, my rainy nights with pattering feet; smile, my golden autumn; come, careless April, scattering your kisses abroad.
You come, and you, and you also!
My loves, you know we are mortals.
Is it wise to break one’s heart for the one who takes her heart away? For time is short.
It is sweet to sit in a corner to muse and write in rhymes that you are all my world.
It is heroic to hug one’s sorrow and determine not to be consoled.
But a fresh face peeps across my door and raises its eyes to my eyes.
I cannot but wipe away my tears and change the tune of my song.
For time is short.

Tagore Rabindranath - The gardener






Thứ Tư, 23 tháng 7, 2025

Nom Na Tong

Render font Nom Na Tong

\documentclass[11pt]{article}
\usepackage{fontspec}
\setmainfont{NomNaTong-Regular}
\usepackage{luacode}
\usepackage{longtable,array,xcolor,listings}
\begin{luacode*} 
function print_glyphs(maxCols,maxChars) 
  local id = font.current()         -- get Font ID
  local fnt = font.getfont(id)
  local col = 1
  local maxU4 = 15*(16^3+16^2+16+1)
  a = {}
  for k, v in pairs(fnt.characters) do
    a [#a + 1] = k
  end
  table.sort(a)
  for i, k in ipairs(a) do
    if i >= maxChars then break end
    if col == 1 then
      if k > maxU4 then
        tex.sprint(string.format("U+%06x", k))
      else
        tex.sprint(string.format("U+%04x", k))
      end
      tex.sprint("&") 
    end
    if (i) then
      tex.sprint(string.format([[\char%i]], k))
    else
     tex.sprint("~")
    end
    if col == maxCols then              -- Line finished?
      tex.sprint([[\\\cline{2-]] .. maxCols+1 .. "} ")  -- Yes
      col = 1                           -- newline
    else
      tex.sprint("&")                   -- no, Print &
      col = col + 1                     -- next column
    end
  end
end
\end{luacode*}


\begin{document}

\color{black!20}

\begin{longtable}{>{\color{black!50}\ttfamily\footnotesize}r|
                  *{10}{>{\color{black}}p{1.5em}|}}
\cline{2-11}
\endhead


\directlua{print_glyphs(10,65463)} \\ \cline{2-11}
\end{longtable}

\end{document}

Tách một file pdf gồm 90 trang ra 90 file pdf

Công việc này thực hiện trên MacBook
  1. Cài đặt công cụ (nếu chưa có):
    sudo apt-get install poppler-utils # Ubuntu/Debian brew install poppler # macOS

     

  2. Tạo script split_pdf.sh:
    #!/bin/bash input_pdf="input.pdf" # Thay tên file PDF gốc output_prefix="page" # Tiền tố tên file output # Tách từng trang thành file riêng pdfseparate "$input_pdf" "${output_prefix}_%d.pdf"

     

  3. Chạy script:
    chmod +x split_pdf.sh ./split_pdf.sh

     

Kết quả: page_1.pdf, page_2.pdf, ..., page_90.pdf