DEV Community

Long Nguyễn Xuân
Long Nguyễn Xuân

Posted on • Edited on

1

code block trong MSWord

Khi viết các tài liệu liên quan tới IT, việc chèn vào đó một vài đoạn code là chắc chắn, nhưng nếu viết code ở font "thường" thì nhìn nó không "hợp lý"

nếu viết để xuất bản ở dạng web, thường chỉ cần 3 dấu backtick trong markdown là đủ, một số website còn cho bạn chọn syntax highlight, nhưng khi viết trong MSWord thì sao?

Syntax Highlight thì chịu rồi, cơ mà chúng ta có thể dùng chức năng "Style" trong MSWord để định dạng 1 "paragraph" là "code block", cách làm như sau

  1. chọn 1 đoạn văn bản, định dạng thành loại font thích hợp (code nên sẽ là monospace, mà trong Word mặc định thì font monospace thích hợp nhất là Consolas 😍 chứ cái Courier New nhìn xấu òm 🥲
  2. Select đoạn đó, right-click chọn Paragraph, để chỉnh lại cái spacing, indent, border. Image description
  3. thông thường, text trong các tài liệu dạng paper này sẽ là spacing double, nên mình sẽ chọn cho cái code block là font : Consolas font size = 10 (1 dòng trong trang A4 margin left right 1 inch chứa dc 80 kí tự) line spacing single mấy cái này là phong cách thôi, các bạn căn chỉnh cho phù hợp nhé! chọn thêm Outside border Image description
  4. kết quả dc như sau Image description
  5. sau đó chúng ta mở control Style, chọn tạo 1 style mới với định dạng của đoạn văn bản vừa thực hiện Image description
  6. lần sau khi cần chọn 1 đoạn văn bản làm "Code Block" thì chỉ cần select đoạn đó và chọn style ở trên chỗ mục Style là xong. Image description

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay