A Not So Short Introduction to LaTeX2ε
Chinese translation: CTEX Development Team
English author: Tobias Oetiker
Hubert Partl, Irene Hyna and Elisabeth Schlegl
A concise reference to Markdown headings, formatting, lists, callouts, tables, links, media, footnotes, and code blocks.
1. Headings and hierarchy (Headings)
Use # to mark a heading. Add a space after #, then enter the heading text.
Level 1 heading (H1):# Level 1 heading
Level 2 heading (H2):## Level 2 heading
Level 3 heading (H3):### Level 3 heading
2. Text formatting (Emphasis)
Italic*italic text* or _italic text_
Bold**emphasized text** or __emphasized text__
Bold italic***bold and italic***
Strikethrough~~incorrect or outdated text~~
Underline<u>implemented with an HTML tag</u>
text with a background highlight Put text between backticks, like \ `text``.
Whitespace entities
Non-breaking space, commonly used to prevent a word from splitting at the end of a line.   En space, approximately the width of the letter n.   Em space, approximately the width of the letter m (usually one full-width character).
3. Lists and organization (Lists)
Unordered list (Unordered List)
Natural Language Processing (NLP) * Natural Language Processing (NLP)
Insert an image much like a hyperlink, but add ! at the beginning.

Example: 
Note: ./落日余晖.jpg means the image is in the same folder as this article, named "落日余晖", with the ".jpg" extension.
This is sample body text with an additional note[^1]. Here is another example footnote[^2].
[^1]: A footnote’s full explanation appears automatically at the end, without interrupting the main text.
[^2]: When writing, put the footnote text after the body, like this.
This is sample body text with an additional note1. Here is another example footnote2.
9. Code blocks (Code Blocks)
Inline code
Wrap text in a single backtick pair, for example `import spacy`; the result is import spacy.
Fenced code blocks (Code Fencing)
Specify a language with ``` to enable syntax highlighting, for example:
```python title="main.py
# 使用 Ginza/spaCy 包
import spacy
nlp = spacy.load("ja_ginza")
print("Successfully nested and wrapped")
```
### This line marks the end, haha, that’s it!
Close the code block with ```. The complete result looks like this:
pythonmain.py
# Use the Ginza/spaCy packageimport spacynlp = spacy.load("ja_ginza")print("Successfully nested and wrapped")
This line marks the end, haha, that’s it!
A few tips
Tip
Markdown supports HTML. If Markdown alone cannot achieve the desired result, try using HTML.
For example, use <br> between lines or blocks to force a line break.
For k vectors v1, v2, ..., vk, if c1v1 + c2v2 + ...+ ckvk = 0 only happens when c1 = c2 = ... = ck = 0, the vectors v1, v2, ..., vk are linearly independent.
Otherwise, they are linearly dependent and one of them is a linear combination of the others.
Matrices
Matrix Concepts and Forms
为了简化记录某一Linear Transformations操作的信息
Matrices = Linear Transformations
Linear Independence and Invertible Matrices
一旦接受了"Matrices = Linear Transformations"的理念,我们马上就想知道:这种操作是否可以逆转?
A node is a set of points in a circuit that are directly connected by ideal wires and have the same electric potential.
A node is an electrically connected region of wire, not merely a small dot. If no component lies between points, the entire continuous wire is one node.
Loop(loop)
Mesh(mesh)
A mesh is a loop that cannot be divided into smaller loops.
注
一个未知电路中若有B个元件,Then,有2B个电路变量(Vx和Ix)
关系式:M=B−(N−1)
KCL
The algebraic sum of currents leaving a node is zero (currents entering are negative).
K=1∑nIK=0
KVL
The algebraic sum of voltage drops around a loop is zero (taking drops as positive).
K=1∑nVK=0
The 2B Method
N个Node,可根据KCL得到N−1equations is
M个Mesh,可根据KVL得到Mequations is
B个元件,可根据componentmodel得到Bequations is
From the NMB relation, the total number of
N−1+M+B=2B
equations is
Quick Analysis of Simple Resistive Networks
Understanding Equivalent Resistance
Req=R1+R2+...+Rn=Ra∥Rb∥...∥Rz
They are called equivalent resistances not because their numerical values are equal, but because in the same circuit environment they produce the same external voltage and current. Do not reverse this cause and effect.
In particular, for a parallel circuit, the equivalent-resistance formula follows from:
Req1=i=1∑nRi1
which yields:
Req=i=1∑nj=1j=i∏nRjR1R2⋯Rn
For example:
Equivalent resistance of three parallel resistors
Over one full period (T), trigonometric functions satisfy the following orthogonality relations:
∫t0t0+Tsin(mω0t)dt=0for all m∫t0t0+Tcos(mω0t)dt=0for all m∫t0t0+Tcos(mω0t)sin(nω0t)dt=0for all m,n∫t0t0+Tsin(mω0t)sin(nω0t)dt=⎩⎨⎧0,2T,m=nm=n∫t0t0+Tcos(mω0t)cos(nω0t)dt=⎩⎨⎧0,2T,m=nm=n
This is the average-power formula for a periodic signal containing a DC component and harmonics.
Calculating Average Power from RMS and Equivalent DC Values
六、电路与拉普拉斯变换
Laplace Transform
Laplace Transform Formulas
Inverse Laplace Transform Formulas
S域中的电路分析
S域中的KCL与KVL
S域中的Component Models
Resistor
Inductor
Capacitor
Transfer Functions
Definition of a Transfer Function
Y(s) is the Laplace transform of the output signal, and X(s) is the Laplace transform of the input signal.
The relationship between the transfer function H(s), Y(s), and X(s) is
H(s)=X(s)Y(s)
where
When the input signal becomes X′(s), the corresponding output is
Y′(s)=H(s)X′(s)=X(s)Y(s)X′(s)
注
暂态解必定来源于Transfer Functions的极点,稳态解必定来源于输入电源的零点
Applications of Transfer Functions
Transfer Functions and the Superposition Principle
Transfer Functions and the Superposition Principle
If a circuit contains two or more voltage or current sources,
The multiple HVn/In(s) obtained from the superposition principle are the transfer functions from each of the n inputs to the output, with each input acting alone.
Therefore, the complete system is:
PostgreSQL is an open-source Relational Database Management System (RDBMS)
It is known for its stability, standards compliance, and rich data type support, and is widely used in web development, data analysis, and enterprise applications.
After installation, add the path to the environment variables
D:\Database\PostgreSQL\bin
Verify the version
powershell
psql --version
Introduction to tables, databases, and SQL
Basic table structure
A table is the basic unit for storing data in a database
It can be thought of as a two-dimensional grid of rows and columns.
The database maintains the relationships between these tables and ensures data consistency and security.
SQL basics
SQL (Structured Query Language) is the standard language for working with relational databases.
SQL can be used to:
Create databases and tables (CREATE)
Query data (SELECT)
Insert data (INSERT)
Update data (UPDATE)
Delete data (DELETE)
For example:
sql
SELECT * FROM users;
This queries all data in the users table.
SQL is a fundamental tool for working with relational databases such as PostgreSQL, MySQL, and SQLite.
PostgreSQL fundamentals
1. Create a database and table
sql
-- Create a databaseCREATE DATABASE mydb;-- Connect to the database\c mydb-- Create a tableCREATE TABLE users ( id SERIAL PRIMARY KEY, username VARCHAR(60) NOT NULL, email VARCHAR(100) UNIQUE NOT NULL, age INT, created_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
Note: A column uses the format field namedata type[(length)][constraint/modifier].
2. Drop a database or table, or clear a table
sql
-- Drop a database (you cannot drop the database you are currently connected to)DROP DATABASE mydb;-- Drop a table (including its structure and data)DROP TABLE exTable;-- Clear table data while keeping its structure (faster than DELETE, but does not log individual rows)TRUNCATE TABLE exTable;--
3. Add a column or change a data type
sql
-- Add a column:ALTER TABLE exTable ADD COLUMN age INT;-- Change a data type:ALTER TABLE exTable ALTER COLUMN email TYPE VARCHAR(255);
4. Read, insert, update, and delete data
Read
sql
-- Query all dataSELECT * FROM exTable;-- Filtered querySELECT username, email FROM exTable WHERE id > 1;-- Pattern matching (ILIKE is case-insensitive, a PostgreSQL feature)SELECT username, email FROM exTable WHERE username ILIKE 'tech%';-- Sort and limit; ascending by default, DESC for descendingSELECT * FROM exTable ORDER BY created_time DESCLIMIT 6;
Insert
sql
-- Insert one rowINSERT INTO exTable (username, email) VALUES ('alice', 'alice@example.com');-- Insert multiple rowsINSERT INTO exTable (username, email)VALUES('bob', 'bob@example.com'),('charlie', 'charlie@example.com');
Update
sql
UPDATE exTable SET email = 'alice_new@example.com'WHERE username = 'alice';
Always specify a scope when updating a table; otherwise, every row may be changed.
Delete
sql
DELETE FROM exTable WHERE username = 'charlie';
PostgreSQL next-step fundamentals (T+1)
Prerequisite: You should know how to create tables and perform basic CRUD operations.
Goal: Write more precise queries, understand data constraints, and get an introduction to joins across multiple tables.
Combine conditions: AND / OR / NOT
sql
-- AND: both conditions must be trueSELECT * FROM usersWHERE age >= 18 AND age <= 30;-- OR: either condition can be trueSELECT * FROM usersWHERE username = 'alice' OR username = 'bob';-- NOT: excludeSELECT * FROM usersWHERE NOT age < 18;
Ranges and lists: BETWEEN / IN
sql
-- BETWEEN (inclusive)SELECT * FROM usersWHERE age BETWEEN 18 AND 30;-- IN (equivalent to multiple OR conditions, but more concise)SELECT * FROM usersWHERE username IN ('alice', 'bob', 'charlie');-- NOT IN (exclude a list)SELECT * FROM usersWHERE username NOT IN ('alice', 'bob');
Check for null values: IS NULL / IS NOT NULL
sql
-- Find users with no age (note: do not use = NULL)SELECT * FROM usersWHERE age IS NULL;-- Find users who have entered their ageSELECT * FROM usersWHERE age IS NOT NULL;
NULL is not the same as an empty string '' or 0; it represents an "unknown value" and must be checked with IS NULL.
Aggregate functions: summarize a set of values
Function
Purpose
COUNT()
Count
SUM()
Sum
AVG()
Average
MAX()
Maximum
MIN()
Minimum
sql
-- Number of usersSELECT COUNT(*) FROM users;-- Average user ageSELECT AVG(age) FROM users;-- Maximum and minimum user agesSELECT MAX(age), MIN(age) FROM users;-- Note: COUNT(*) counts all rows; COUNT(age) skips NULL valuesSELECT COUNT(*), COUNT(age) FROM users;
GROUP BY: aggregate by group
Group the data by a column, then aggregate each group.
sql
-- Create an orders table for this exampleCREATE TABLE orders ( id SERIAL PRIMARY KEY, username VARCHAR(60) NOT NULL, product VARCHAR(60), amount INT, created_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP);INSERT INTO orders (username, product, amount) VALUES('alice', 'book', 120),('alice', 'pen', 30),('bob', 'book', 120),('bob', 'bag', 200),('charlie','pen', 30);
sql
-- Number of orders per userSELECT username, COUNT(*) AS order_countFROM ordersGROUP BY username;-- Total spending per userSELECT username, SUM(amount) AS total_spentFROM ordersGROUP BY username;
Example output:
username
total_spent
alice
150
bob
320
charlie
30
Query execution order (important!)
Many SQL errors beginners encounter come from misunderstanding the execution order:
FROM → Choose the data source
WHERE → Filter source rows
GROUP BY → Group rows
HAVING → Filter grouped results
SELECT → Select columns (aliases become available here)
ORDER BY → Sort rows
LIMIT → Limit the number of rows
sql
-- Common mistake: using an alias from SELECT in WHERE-- ❌ Incorrect: WHERE runs before SELECT, so total_spent does not exist yetSELECT username, SUM(amount) AS total_spentFROM ordersWHERE total_spent > 100 -- This causes an error!GROUP BY username;-- ✅ Correct: use HAVINGSELECT username, SUM(amount) AS total_spentFROM ordersGROUP BY usernameHAVING SUM(amount) > 100;
Give columns and tables aliases with AS
sql
-- Column aliases (make output easier to read)SELECT username AS username, SUM(amount) AS total_spendingFROM ordersJOIN users ON orders.user_id = users.idGROUP BY username;-- Table aliases (shorten long names; useful in multi-table queries)SELECT u.username, o.product, o.amountFROM users AS uJOIN orders AS o ON u.id = o.user_id;
Exercises
Use the following two tables to complete these exercises:
sql
-- Prepare sample dataINSERT INTO users (username, email) VALUES('alice', 'alice@example.com'),('bob', 'bob@example.com'),('charlie', 'charlie@example.com');INSERT INTO orders (user_id, product, amount) VALUES(1, 'book', 120),(1, 'pen', 30),(2, 'book', 120),(2, 'bag', 200);-- charlie has no orders
Query every username and their total order amount, sorted by total amount in descending order
Find users whose total spending exceeds 100
Query all users, including those without orders (hint: LEFT JOIN)
Count how many times each product was sold
Chapter outline
T+1 SQL fundamentals
├── Conditional queries
│ ├── AND / OR / NOT
│ ├── BETWEEN / IN
│ └── IS NULL / IS NOT NULL
├── Aggregation
│ ├── COUNT / SUM / AVG / MAX / MIN
│ ├── GROUP BY
│ └── HAVING
├── Query execution order
│ └── FROM→WHERE→GROUP BY→HAVING→SELECT→ORDER BY→LIMIT
└── Joins across tables
├── Foreign keys REFERENCES
├── INNER JOIN
├── LEFT JOIN
└── Column/table aliases with AS
Use PostgreSQL with Python
1. Install the dependency
To work with a database from Python, first install the psycopg2 package.
powershell
pip install psycopg2-binary
2. Run SQL from Python
python
import psycopg2# Connect to the databaseconn = psycopg2.connect( dbname="mydb", user="your_user", password="your_password", host="localhost", port="5432")
Parameter descriptions:
Parameter
Description
dbname
Database name
user
PostgreSQL username
password
User password
host
Database server address (usually localhost for a local server)
port
PostgreSQL’s default port is 5432
After connecting, conn represents a database connection object.
3. Create a cursor
In Python, SQL statements are not executed directly by the connection object. They are executed through a Cursor.
python
cur = conn.cursor()
Where:
Connection is responsible for connecting to the database
Cursor is responsible for executing SQL
You can think of a cursor as:
An "operation window" between Python and the database.
Use cur.execute("SQL statement") to run an operation
All subsequent SQL statements are executed through the cursor. A Connection can create multiple cursors.
4. Insert data (INSERT)
For example, suppose we have the following table:
sql
CREATE TABLE exTable ( id SERIAL PRIMARY KEY, username TEXT, email TEXT);
For inserts, parameterized queries are recommended:
python
cur.execute("SQL statement for inserting data", parameters)
INSERT INTO score VALUES(1,1,90),(1,2,85),(2,2,95),(2,3,88),(3,1,76);
Join tables and query across them
In real databases, information is usually split across tables by data type instead of being stored in one table.
For example:
Student information is stored in the student table.
Course information is stored in the course table.
Score information is stored in the score table.
How can the database tell:
that a score of 90 is Zhang San’s score in Python?
The answer:
these tables are linked through shared fields.
For example:
student
text
sid
and
score
text
sid
refer to the same student.
course
text
cid
and
score
text
cid
refer to the same course.
This method of linking tables through shared fields is called a relation.
Foreign keys: links between tables
A foreign key constrains the relationship between two tables and prevents "orphaned data".
sql
-- Rebuild the score table (drop it first if it already exists)DROP TABLE IF EXISTS score;-- The sid and cid columns in score reference the student and course tables respectivelyCREATE TABLE score ( sid INT REFERENCES student(sid), cid INT REFERENCES course(cid), score INT);
Here, both sid and cid are foreign keys.
sid references sid in the student table.
cid references cid in the course table.
Foreign keys link tables and ensure data consistency.
For example, if there is no student with sid=100 in the student table, the following statement will fail:
sql
INSERT INTO score VALUES (100, 1, 90);
The database reports an error because the foreign key requires score.sid to match an existing sid in the student table.
Likewise, a score record cannot be inserted if its course ID does not exist in the course table.
Foreign keys therefore prevent references to nonexistent data and keep data consistent across tables.
JOIN: an introduction to multi-table queries
Foreign keys define relationships between tables, while JOIN uses those relationships to combine data from multiple tables in a query.
For example:
The student table stores student information;
The course table stores course information;
The score table stores score information.
To query a student’s name, course name, and score, use JOIN because this information is stored in different tables.
This section introduces the most common join: INNER JOIN.
INNER JOIN
INNER JOIN returns only rows that match successfully in both tables.
A single SQL query can retrieve information from all three tables.
Thus, INNER JOIN uses relationships among multiple tables
to combine information from different tables in one result, making it one of the most common ways to query across tables in SQL.
Subqueries
Sometimes an SQL query needs the result of another query before it can continue.
This technique of nesting one SQL statement inside another is called a subquery or nested query.
A subquery is usually placed in parentheses (). The database runs the subquery first, then the outer query.
Basic form:
sql
SELECT ...FROM ...WHERE column = ( SELECT ...);
Example 1: Find the highest score and its record
First, query the highest score in the score table:
sql
SELECT MAX(score)FROM score;
Result:
95
To retrieve the record with the highest score directly, use the query above as a subquery:
sql
SELECT *FROM scoreWHERE score = ( SELECT MAX(score) FROM score);
The execution proceeds as follows:
① The subquery runs first:
sql
SELECT MAX(score)FROM score;
Result:
95
② The outer query then runs:
sql
SELECT *FROM scoreWHERE score = 95;
This returns the record with the highest score.
Example 2: Query scores for the database course
Suppose you know the course name "Database" but not its ID.
First, query the course ID:
sql
SELECT cidFROM courseWHERE cname = 'Database';
Result:
2
Then query the scores:
sql
SELECT *FROM scoreWHERE cid = ( SELECT cid FROM course WHERE cname = 'Database');
This way, you do not need to enter the course ID manually.
Example 3: Use an IN subquery
A subquery may sometimes return multiple rows; use IN in that case.
For example: query the IDs of all students taking Python.
sql
SELECT sidFROM scoreWHERE cid IN ( SELECT cid FROM course WHERE cname = 'Python');
IN means:
Check whether a value exists in the set returned by a subquery.
If a subquery returns multiple results, = cannot be used; use IN instead.
Subqueries versus regular queries
Regular query:
sql
SELECT *FROM scoreWHERE cid = 2;
You need to know the course ID in advance.
Subquery:
sql
SELECT *FROM scoreWHERE cid = ( SELECT cid FROM course WHERE cname = 'Database');
You do not need to know the course ID; the database finds it automatically.
Subqueries make SQL more flexible and queries more convenient.
Characteristics:
Subqueries are usually placed inside ().
The database runs the subquery before the outer query.
Use = when the subquery returns a single result.
Use IN when the subquery returns multiple results.
Subqueries are often used to look up a condition first, then continue the query based on that result.
Ling.2026.04.19toeic
TOEIC単語リスト
Some words extracted from TOEIC L&R OFFICIAL VOCABULARY BOOK
Math & Coding2026.04.03zotero / webdav
Add 25 GB of Zotero Storage
Use a cloud drive’s WebDAV feature to expand Zotero storage to 25 GB at no cost.
An InfiniCLOUD account (or any cloud drive with WebDAV support)
Configure WebDAV
Open the My Page page in InfiniCLOUD
Find Apps Connection below
Click Reissue to display the connection password
Note: Every time you click Reissue, the connection password is reset. All devices will then fail server verification!
Once the password is displayed, save it and avoid clicking Reissue repeatedly.
Copy the following three items:
WebDAV Connection URL Connection ID Apps Password
By the way, scroll down past step 4. and enter my invitation code A2Y4K to get an extra 5 GB of storage~
Open Zotero and select Edit - Settings - Sync - File Sync in the upper-left menu.
Change the sync method from Zotero to webdav.
In the dialog, enter the information copied in step 4.exactly.
After checking the information, click Verify Server and wait for the File Sync Setup Succeeded message.
Close the message and use zotero as usual.
Troubleshooting
Cannot open the InfiniCLOUD sign-up page
InfiniCLOUD is a Japanese cloud drive. A VPN may occasionally be needed, but in most cases you can connect directly.
Server verification failed
Carefully check the connection ID and password. The connection ID is neither your InfiniCLOUD user ID nor your zotero ID.
Follow steps 4. and 7. exactly.
Check whether you clicked Reissue again and reset the connection password.
Server verification succeeds, but a red ! appears next to sync in the upper-right corner of the zotero home page and files do not sync.
If server verification succeeds but zotero still cannot sync files to the cloud, the WebDAV configuration is not the problem.
Check your network connection. You can sync files from China without an accelerator!
Server verification succeeds and zotero syncs files to the cloud, but other devices cannot view or download them.
The problem is on the other device. Check the sync settings on the device that cannot view or download cloud files.
Follow the same steps in Configure WebDAV above.
Zotero plugins
Download Zotero plugins
In the zotero home page, find and click Tools - Plugins.
Beginner-friendly and simple to use, with almost no learning curve
Offers a good range of tokenization features and export formats, including Excel and 大納言
Disadvantages:
Limited features and customization
Difficult to automate with large texts; Python + the MeCab module + a dictionary package is recommended
2. Install the MeCab application (Windows)
Download and install: mecab-0.996.exe
The application itself is small, so installing it on drive C is recommended. To install it on drive D, add it to the system environment variables after installation.
MeCab requires a dictionary file. Installation automatically creates the ipadic dictionary, which is outdated and no longer updated.
Replacing it with a custom dictionary package is strongly recommended!!!
Custom dictionary package: This example uses the latest unidic-cwj-202512 released by the National Institute for Japanese Language and Linguistics.
After downloading unidic-cwj-202512.zip, extract it to a folder of the same name in the root of drive D (or C).
Copy the path of the unidic-cwj-202512 folder: "D:\unidic-cwj-202512".
Find the installed MeCab folder and open "D:\MeCab\etc\mecabrc" in Notepad (use the corresponding path if installed on drive C).
Paste the path from step 2 after dicdir =, like this: dicdir = D:\unidic-cwj-202512.
This sets the custom dictionary MeCab will use at runtime.
Next, use MeCab on Windows
Search for PowerShell in the lower-left search box. Right-click it and choose Run as administrator.
Because of encoding limitations, set the PowerShell console encoding before using MeCab.
Enter the following in the command line: $OutputEncoding = [Console]::InputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
This forces UTF-8 encoding to prevent garbled text.
Enter the mecab command to start the mecab program, which will wait for text or a file to tokenize.
The following describes manual input and file-based input/output.
Manual input is simple: copy the text to tokenize and paste it into the command line.
Press Enter; the tokenized result appears on screen and can be copied.
To tokenize an entire file (it must be a .txt file; convert other formats to .txt first)
Enter the following command (use -o to specify the output file and -O to specify the output format; the options are case-sensitive): mecab "C:\Users\...\test.txt" -o "C:\Users\...\ed.txt" -Ounidic Notes: "C:\Users\...\test.txt" This is the path to the file you want to tokenize, "C:\Users\...\ed.txt" this is the path where you want to save the tokenized output, -Ounidic means: use the -O option to select the unidic output format (the default format can be customized; see Custom tokenization below).
3. Install Python to use with MeCab (recommended)
Download and install Python and an editor (PyCharm, VS Code, Zed, or another editor)
Add Python to the environment variables
Search for environment variables in the lower-left Windows search box, open Edit the system environment variables, then click Environment Variables in the lower-right.
Under User variables for xx, select Path, click Edit, then click New.
Copy and paste the path to the Python installation folder, then click OK until you close the Environment Variables settings.
Example: D:\Python3.12.9\
Use the pip package manager to install the MeCab package
Enter this in the PowerShell command line: pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
This command sets the Tsinghua package mirror. Without it, installing packages with pip from China can be difficult.
In the PowerShell command line, run pip install mecab-python3 to install the MeCab package.
Open your editor and configure the Python environment (the steps differ by editor; search for a tutorial if needed).
Everything is ready. Let’s begin!
Enter the following code to import the MeCab package into Python.
python
import MeCab# Specify a dictionary before tokenizing with MeCab, then initialize the MeCab tagger.# Use the custom dictionary unidic-cwj-202512; unidic_path is its location.unidic_path = r"D:\unidic-cwj-202512"
Enter the following code to initialize MeCab.
python
# Initialize the tagger with tagger = MeCab.Tagger(); pass custom options in the parentheses.# -r "{mecabrc}" specifies an empty config file; -d "{unidic_path}" points to the custom dictionary.tagger = MeCab.Tagger(f'-r nul -d "{unidic_path}"') # Output detailed tokenization information by default
Tokenize text or a file and print the result.
python
text = "勉強は大好きだ。"result = tagger.parse(text)print(result)# No output mode was specified, so detailed tokenization information is shown by default.>>>- 名詞,普通名詞,サ変可能,*,*,*日本橋 名詞,固有名詞,地名,一般,*,*,ニホンバシ,ニホンバシ,日本橋,ニホンバシ,日本橋,ニホンバシ,固,*,*,*,*,*,*,地名,ニホンバシ,ニホンバシ,ニホンバシ,ニホンバシ,0,*,*,7830455558742528,28487は 助詞,係助詞,*,*,*,*,ハ,は,は,ワ,は,ワ,和,*,*,*,*,*,*,係助,ハ,ハ,ハ,ハ,*,"動詞%F2@0,名詞%F1,形容詞%F2@-1",*,8059703733133824,29321いい 形容詞,非自立可能,*,*,形容詞,連体形-一般,ヨイ,良い,いい,イー,いい,イー,和,*,*,*,*,*,*,相,イイ,イイ,イイ,イイ,1,C3,*,10716948459561665,38988ところ 名詞,普通名詞,副詞可能,*,*,*,トコロ,所,ところ,トコロ,ところ,トコロ,和,ト濁,基本形,*,*,*,"B1WS2WB3WB4WBjS,B1WS2WB8SjS",体,トコロ,トコロ,トコロ,トコロ,"3,0",C2,*,7249372253397504,26373です 助動詞,*,*,*,助動詞-デス,終止形-一般,デス,です,です,デス,です,デス,和,*,*,*,*,*,*,助動,デス,デス,デス,デス,*,"形容詞%F2@-1,動詞%F2@0,名詞%F2@1",*,7051468750332587,25653ね 助詞,終助詞,*,*,*,*,ネ,ね,ね,ネ,ね,ネ,和,*,*,*,*,*,*,終助,ネ,ネ,ネ,ネ,*,"動詞%F1,名詞%F1,形容詞%F1",*,7903847959896576,28754。 補助記号,句点,*,*,*,*,*,。,。,*,。,*,記号,*,*,*,*,*,*,補助,*,*,*,*,*,*,*,6880571302400,25EOS
Custom tokenization modes
The steps for specifying a MeCab output mode are the same in PowerShell and Python, so the example below uses Python.
python
# Note: Add an entry for each custom output mode to the dictionary dicrc file. Modes already in dicrc can be used directly.# For example, the built-in concise mode wakati tokenizes 「勉強は大好きだ。」 as shown: 勉強 は 大好き だ 。# To use it, append -Owakati to the MeCab initialization command.# That is, add a hyphen, uppercase O, and the output mode, as shown below.tagger = MeCab.Tagger(f'-r nul -d "{unidic_path}" -Owakati')text = "勉強は大好きだ。" # This is the text to tokenize.result = tagger.parse(text)print(result)>>> 勉強 は 大好き だ 。
If you defined a custom tokenization mode in the dictionary’s dicrc file, use the following code to select it along with the dictionary:
Netlify(for a custom domain; you can skip this for now)
CAUTION
If you download and install software using an .msi file, you may encounter installation errors 2503 or 2502
Here is how to fix it:
Click the Start icon in the lower-left corner of the desktop and search for powershell
Right-click and Run powershell as administrator, then enter *msiexec /i "path to the .msi installer"* and press Enter
For example:
To force-install the installer "go1.26.5.windows-amd64.msi" from the All downloads folder on drive D:
enter this in powershell: *msiexec /i "D:\All downloads\go1.26.5.windows-amd64.msi"*
2. Verify the versions
After installation, verify in PowerShell:
powershell
node -vnpm -vgit --version
Press Enter to run each command! If a version number is displayed, the installation succeeded.
If a command hangs or produces no result, press Ctrl+C to stop it.
The first time you try to run a script this way, you may also see a message saying that script execution is disabled on this system.
This is caused by PowerShell’s execution policy, which blocks script files.
Solution
Change the PowerShell execution policy
Open PowerShell as an administrator and run:
Open a terminal in the blog project folder and enter:
powershell
# This is an essential step where every blog project begins. Choose either of the following commands.pnpm create astro@latest <project-name> -- --template <template-repository>git clone <theme-github-repository-url> <blog-folder># Full command examples using two different themespnpm create fuwari@latest <MyBlog>orgit clone https://github.com/hanityx/astro-tone.git MyBlog
Notes
Step 2 creates an empty blog project folder locally, copies the selected theme into it, and initializes the project.
project name = blog folder name: the folder you just created on drive D, which should no longer be empty!
template repository = the GitHub repository URL of your chosen theme. On the theme page, click Get started and scroll down to find it.
Install dependencies
Run this for every new blog project to install its dependencies and tools.
powershell
cd MyBlogpnpm install
Initialize Git and connect a repository
Initialize Git and set the branch name to main
Copy and run the following commands
powershell
Remove-Item -Recurse -Force .git git init git add .git commit -m "Initialize my new blog theme"git branch -M main
Connect to and push to a GitHub repository
Note: Find the repository URL when you create it and replace the example below.
powershell
git remote add origin https://github.com/Zes-Z/test.git git push -u origin main
Notes
After step 5, your blog project files should appear in the GitHub repository exactly as they do locally.
Next, we’ll deploy the blog so everyone can visit it in a browser.
Deploy the repository to GitHub Pages (or another host)
If you use another hosting service or have a custom domain, skip step 6
and go to Deploy the blog to Netlify below.
Create a GitHub Actions workflow
Note: Some blog themes include this file. If yours does, go directly to step 7.
If MyBlog\.github\workflows\deploy.yml does not exist, create it yourself.
In your project root, create a folder named .github.
Inside .github, create another folder named workflows.
Inside workflows, create a file named deploy.yml.
The final file path should look like this: D:\ZesProjects\MyBlog.github\workflows\deploy.yml
In the Build and deployment -> Source section in the center of the page, click the dropdown menu.
Change the default Deploy from a branch option to GitHub Actions.
Edit astro.config.mjs in the blog root
Replace the code around line 9 with:
yaml
export default defineConfig({ site: 'https://Zes-Z.github.io', # your GitHub domain base: '/test/', # your repository name; use base: '/' if this is your first project repository,
Push the configuration
Return to the terminal and enter:
This command generates static HTML from the Markdown content.
2 Start the local server
powershell
hexo s
Open this address in your browser:
powershell
http://localhost:4000
You should see the blog with its default theme. See the end of this guide to customize it.
4. Create a post
After previewing in the previous step, press Ctrl+C in the terminal to stop the server.
输入以下命令以Create a post:
powershell
hexo new "first post"
Hexo will create this file:
powershell
source/_posts/first-post.md
A basic post looks like this:
---
title: First Post
date: 2026-03-15
tags:
---
Write the post content in this .md file. You can open and edit it with Notepad.
5. Create a GitHub repository
Sign in to GitHub, or create an account if you don’t have one.
Create a repository named username.github.io.
For example: zeszheng.github.io
This repository will host your blog.
Copy the SSH URL; you’ll need it shortly.
6. Install the deployment plugin
Hexo needs a deployment plugin to publish to GitHub Pages.
Install it:
powershell
npm install hexo-deployer-git --save
7. Configure deployment
Edit this file in the blog root:
_config.yml
This file is used to customize the website.
Add the deployment configuration:
deploy:
type: git
repo: https://github.com/username/username.github.io.git
branch: main
Replace username with your GitHub username.
8. Deploy the blog
Run:
powershell
hexo clean # Clear the Hexo cachehexo g # Generate the sitehexo d # Deploy to the remote GitHub repository
After deployment, visit:
https://username.github.io
Your blog should now be online.
9.Everyday writing workflow
The basic Hexo workflow is as follows.
1 Create a post
powershell
hexo new "post title"
2 Preview locally
powershell
hexo ghexo s
3 Publish the blog
powershell
hexo cleanhexo ghexo d
Hexo workflow summary
Install Node.js and Git, and configure a registry mirror
Install the Hexo CLI
Initialize a Hexo project
Run the blog locally
Create a GitHub repository
Configure deployment插件
Publish to GitHub Pages
For everyday writing after setup, run:
powershell
# Run blog commands from this root folder. In PowerShell, first enter:cd Myblog hexo newhexo ghexo s # Press Ctrl+C to stop the local preview before running hexo dhexo d # Push to GitHub
This completes the writing, preview, and publishing workflow.
Customize the Hexo theme
Browse and choose a theme on the official Hexo Themes page.
Click Visit preview site to preview a theme.
Click the theme name link to open its GitHub repository, then follow its instructions to clone and use the theme.